这段来自api的话没看懂,求解释
 发布于 12 年前  作者 ceclinux  4215 次预览  最后一次回复是 12 年前  来自  

In browsers, the top-level scope is the global scope. That means that in browsers if you’re in the global scope var something will define a global variable. In Node this is different. The top-level scope is not the global scope; var something inside a Node module will be local to that module.

3 回复
peiweippww

大概意思是在node中你定义的全局变量其实非全局变量,它依托于所在的module。

就好比所在的module是个命名空间,这个变量从属于它

blacktea

应该是说浏览器中文件里最外层的var定义是成全局的,即别的文件也能直接访问它 但在node中不一样,文件里最外层的var定义只有文件内部可以访问到它,如果要别的文件也能访问,则需要用exports

ceclinux

感谢,明白了