Self-invoking
functions
What is a self-invoking function?
● A function that invokes itself immediately after its definition is referred to as a
self-invoking (or self-executing) function.
● A second set of parentheses follows the set of parentheses surrounding the
anonymous function (which performs the execution).
Syntax:
(function (parameters) {
//body of the function
})(arguments);
Examples
Examples
● Parameters can also be passed in a self invoking function.
THANK YOU