0% found this document useful (0 votes)
3 views5 pages

Self invoking functions

A self-invoking function is one that executes immediately after its definition, characterized by an additional set of parentheses following the function's parameters. This allows for the passing of arguments directly into the function. The document provides a basic explanation and syntax for creating self-invoking functions.

Uploaded by

ramp68201
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views5 pages

Self invoking functions

A self-invoking function is one that executes immediately after its definition, characterized by an additional set of parentheses following the function's parameters. This allows for the passing of arguments directly into the function. The document provides a basic explanation and syntax for creating self-invoking functions.

Uploaded by

ramp68201
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

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

You might also like