诡异的Javascript
Javascript 不存在块层次的作用域。
var scope = "global";function f( ) {//这里引用的仍然是f内的scope,只是这个时候,变量 scope还未被赋值。 alert(scope); // Displays "undefined", not "global" var scope = "local"; // Variable initialized here, but defined everywhere alert(scope); // Displays "local"}f( );