JavaScript - Why is this function declaration created in a function expression “undefined”?

后端 未结 3 1379
执念已碎
执念已碎 2020-11-30 15:25

I\'m just trying to get my head around this function expression.

It seems that if I create a function expression (p) that seems to contain a function de

3条回答
  •  春和景丽
    2020-11-30 16:09

    It seems that if I create a function expression (p) that seems to contain a function declaration

    No. It is a named function expression, which does not "contain" a function declaration. The name of the function expression is available as an identifier inside the function's scope (pointing to the function itself), and as the nonstandard name property.

提交回复
热议问题