TL;DR: In ES6, an IIFE is implemented as follows:
1 2 3 | (() => {...})(); |
… Unlike ES5, which is syntactically less opinionated, in ES6, when using an IIFE, parenthetical order matters. For instance, in ES5 an IIFE could be written either as:
1 2 3 4 5 | // parentheses wrap expression and invocation ... (function() { }()); |
… or
1 2 3 4 5 | // parentheses wrap function expression ... (function() { })(); |
As can be seen in the above examples, in ES5 one could either wrap and invoke a function… Continue Reading