JavaScript: Can I declare variables inside switch cases?
This question already has an answer here:
Yes in javascript you can do this but I think testing it would be much simpler:
Fiddle
var i = 1;
switch ( i ){
case 1:
var a = 1;
alert(a);
break
}
链接地址: http://www.djcxy.com/p/40826.html
上一篇: 变量范围混淆在JavaScript中