JavaScript scope and closure

前端 未结 7 1934
执笔经年
执笔经年 2020-11-28 09:21

I\'m trying to wrap my head around closures (there\'s a joke in there somewhere) and I ran across this:

(function () { /* do cool stuff */ })();
7条回答
  •  清酒与你
    2020-11-28 10:01

    The parens around the function make it clear that the function is an expression. The parens after are the call to the function.

    Notice that the function does not have a name.

提交回复
热议问题