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

后端 未结 3 1405
执念已碎
执念已碎 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:22

    You can think of it as an anonymous function.

    The reason that this is valid is because the local function name a can be used within the function declaration for recursion, but is not valid outside of this scope.

    https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/function

提交回复
热议问题