js 变量及函数声明提升
2019-06-19 本文已影响0人
good__day
a(); // a is not a function, a 应该是 undefined, a 的声明被提升
b(); // Uncaught ReferenceError: b is not defined
var a = function b(){console.log(1)}
a() // 1, a 是 [Function: b]
b() // Uncaught ReferenceError: b is not defined
同理
const C = class CC{}
new C(); // CC {}
new CC(); // Uncaught ReferenceError: CC is not defined