变量

来源:互联网 发布:在linux中echo 编辑:程序博客网 时间:2024/04/29 09:31

函数中声明的所有变量,无论是在哪里声明的,在整个函数中它们都是有定义的。

var scope='global';

function f() {

alert(scope);

var scope='local';

alert(scope);

}

f();

原创粉丝点击