js的变量:js的隐式声名变量总是被创建为全局变量.
code:
- <SCRIPT>
- function test(){
- a=222;
- document.writeln(a);
- }
- test();
- document.writeln(a);
- </SCRIPT>
js的变量作用域:当没有找到变量的时候,它并不会网上一及的函数跑
code:
<SCRIPT >
var x=eee;
document.writeln(x+"!");
a();
function a(){
function b(){
document.writeln(x+"-");
document.writeln(x+"+");
}
document.writeln(x+")");
var x='aaa';
b();
}
</SCRIPT>