-
Immediately-invoked function expressions.
-
A design pattern used by most popular libraries to place all library code inside of a local scope.
-
No global property is created for the function (anonymous function expression).
-
All of the properties created inside of the function expression are scoped locally.
-
Encapsulation, preserve the global namespace as any variables declared within the function body will be local to the closure but will still live throughout runtime.
-
Benefits:
- Local scoping.