美文网首页
js 变量及函数声明提升

js 变量及函数声明提升

作者: good__day | 来源:发表于2019-06-19 18:41 被阅读0次

    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

    相关文章

      网友评论

          本文标题:js 变量及函数声明提升

          本文链接:https://www.haomeiwen.com/subject/kihlqctx.html