ElemeFE/node-interview

模块中的全局变量问题

Closed this issue · 2 comments

模块章节:
如果 a.js require 了 b.js, 那么在 b 中定义全局变量 t = 111 能否在 a 中直接打印出来?
原文写的是可以,并给了示例,但在本机测试会显示referenceerror: t is not defined
是否还有其他的限制条件呢?

@InSpirit12 刚试了下,用 8.1.1 都可以,你的代码?

确实如此