摘要:考虑下面的代码:(function() { var a = b = 5;})();console.log(b);什么会被打印在控制台上?回答上面的代码会打印 5。这个问题的诀窍是,这里有两个变量声明,但 a 使用关键字var声明的。代表它是一个函数的局部变量。与此相反,b 变成了全局变量。这个问题的...
阅读全文
posted @ 2015-03-30 12:18
posted @ 2015-03-30 12:18
posted @ 2015-03-30 12:15
posted @ 2015-03-29 22:13
posted @ 2015-03-29 09:47
posted @ 2015-03-27 23:41