![](/img/trans.png)
[英]when I use global scope variable without 'var', its showing me Error. why?
[英]Why is a variable without the 'var' keyword not in the global scope in the chrome console?
因为我没有使用var关键字,为什么变量'local'不在chrome控制台的全局范围内?
function test(){
local = true;
};
console.log(local);//Uncaught ReferenceError: local is not defined
一旦调用test()
,它将可用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.