Closed cycold closed 6 years ago
boo = "h" var boo = "hello"
=>>> var 声明总是提升到最上面(永远是先声明提升到最上面,然后再逐行赋值)
var boo boo = "h" boo = "hello"
但是let就不是这样
let
boo = "h" let boo = "hello" // 这样就是直接报错了: <- ReferenceError: there is not defined // 因为这里的boo还没有声明呢 不能这么赋值: boo = "h"
=>>> var 声明总是提升到最上面(永远是先声明提升到最上面,然后再逐行赋值)
但是
let
就不是这样