ife 1

ife

//IIFE, aka, 'Immediately Invoked Function Expression'
//The syntax for defining an IIFE can be seen in the following example:

(function(a,b){         
     return a + b; 
})(10,20);

//You can also use an arrow function in defining an IIFE:
(() => {     
    //... 
})();

Here is what the above code is Doing:
1. The function is defined as an anonymous function.
2. The function is immediately invoked.
3. The function is invoked with the arguments 10 and 20.
4. The function returns the sum of the arguments.

Similar Posts