日期:2014-05-16 浏览次数:20349 次
< script type ="text/javascript"> var a = "hello" ; b = "world" ; Test(); function Test() { alert(a + " " + b); var a = "welcome" ; b = "china" ; alert(a + " " + b); } alert(a + " " + b); script >
?
预编译后
?
< script type ="text/javascript"> var a = "hello" ; b = "world" ; function Test() { var a = "undefined" ; ? alert(a + " " + b); a = "welcome" ; b = "china" ; alert(a + " " + b); } Test(); ?alert(a + " " + b); script >
?
当我们写下:var i=1时,其实就是声明了一个window作用域的一个变量。
而当我们写下i=1时,是声明了一个window的属性。
?