闭包:
function 内部访问外部的variables
function f(){
alert(ysr);
}

报错了。
Certain language constructs block the error, for example typeof x works if there is no x (and returnsundefined), but that’s an exception.
特定的语言结构是可以阻塞(拦截)这种错误的,(不让这种错误弹出来!!)。 比如 : typeof ysr, 先用这种语言结构检测一下,就不会报错了!!
If a variable is set, but not found anywhere, then it is created in the outmost LexicalEnvironment, which iswindow.
function f() {
x = 5 // writing x puts it into window
}
原文:http://www.cnblogs.com/oxspirt/p/5899080.html