var a = "a";
function fun1() {
var a = "c";
console.log(a);
}
fun1();//输出c
var b = "b";
function fun2() {
console.log(b);
var b = "d";
//变量提前声明问题
}
fun2();//输出undefined
2021-2-18 js简单面试题 (作用域/变量提前声明)
最新推荐文章于 2021-09-01 11:13:57 发布