let block scope

 // let 关键字声明的变量具有暂时性死区
        var a = 10
        if (true) {
            console.log(a);
            let a = 30
        }

 

 Use const when the value does not need to change. js does not need to monitor the change of value, which is more efficient

Guess you like

Origin blog.csdn.net/weixin_58414196/article/details/130646179