Is this an immediately invoked function expression?

前端 未结 3 1075
广开言路
广开言路 2021-01-28 02:14

I\'m a javascript newbie trying to wrap my mind around this code. I got it here http://brackets.clementng.me/post/24150213014/example-of-a-javascript-closure-settimeout-inside

3条回答
  •  死守一世寂寞
    2021-01-28 02:54

    Yes it is, and the (i) is the argument list for the call. Have a look here for a detailed explanation. The grouping parenthesis are unncessary in this case, as it is an argument to the setTimeout function call and therefore an expression anyway.

    The term IIFE does not only refer to the statement form of this pattern, where the parenthesis would be necessary.

提交回复
热议问题