核心提示:javascript的作用域 . lt;script lanuage=quot;javascriptquot;
var global=quot;javascriptquot;;
test(.
funciton test()
.
var local=quot;vbscriptquot;
document.write(quot;the global isquot;+gloabl+quot;lt;brquot;.
document.write(quot;the local isquot;+local+quot;lt;brquot;.
.
document.write(quot;localquot;.
lt;/script
----------------------------------
错误local已经释放掉了,它的作用域是函数范围内
lt;script language=quot;javascriptquot;
for(var i = 0; i lt; 9; i++)
.
document.write(i+quot;lt;brquot;.
.
document.write(i.
--------------------
i没有被释放,它的作用域是定义后的范围
|