JavaScript IIFE (Immediately Invokable Function Expressions in JavaScript) Design Pattern

Mayank Gupta. CodeProject. 2017-06-15.
This post gives a small introduction about Singleton Pattern in JavaScript.
The post offer you more topics on Object Oriented JavaScript Design.
IIFE (Immediately Invokable Function Expression) is a important concept in JavaScript. it is a commonly used Design Pattern which is used to wrap set of variables and functions which cannot be accessed outside the enclosed scope.
These are Anonymous Function that is wrapped inside a set of paranthesis and is called immediately.
The common advantage of IIFE is that any “Function or Variable” defined inside IIFE, cannot be accessed outside the IIFE block, thus preventing global scope from getting polluted. Also helps us manage memory in an efficient manner.
In order to understand the concept of IIFE, we need to understand the difference between the following:
Function Definition
Function Expression

[JavaScript IIFE (Immediately Invokable Function Expressions in JavaScript) Design Pattern]

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s