It is clear that in EcmaScript, functions when invoked create a new execution context. All variables and functions defined within a function may only be accessed inside that function scope. But when we use closures variables and functions may be accessed outside that context.
IIFE is a function expression that gets invoked immediately. It is simple.
But why are IIFE different from Self-Executing Anonymus Functions, it is not completely clear to me!?
They are the same, it was renamed to
IIFEbecause anIIFEis not necessarily anonymous, and they do not execute themselves.consider the following: