See more
Remember this! You need a function expression to form an IIFE. Function statements/definitions are never used for creating IIFEs.
As we saw in the above IIFE examples, the key to IIFE pattern is taking a function and turning it into an expression and executing it immediately.
So we have a function expression that’s immediately invoked after it’s created. And that’s, my friends, is called an IIFE irrespective of the stylistic variation used to achieve …