let const 全部变量,顶层作用域
let
块集作用域
1.不能够提升 2.有暂时性死区
let a =1;
function a(){
}
以上会报错
let a =1;
{
function a(){
}
console.log(a); //1
}
函数声明提升是提升到当前作用域
块集作用域
1.不能够提升 2.有暂时性死区
let a =1;
function a(){
}
以上会报错
let a =1;
{
function a(){
}
console.log(a); //1
}
函数声明提升是提升到当前作用域