声明提前(变量提升)
javascript在执行代码的时候会将所有使用var声明的变量,放在作用域的顶部集中创建,
赋值留在原地
console.log(a);var a = 20;function go(){console.log("hello world")}var b ="good"输出结果为:undefined
声明提前的执行代码
var a,b;console.log(a);a = 10;b = "good"输出结果为:undefined
在es6中没有声明提前
console.log(a);let a = 10;输出结果报错
