Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

iife in javascript

//expression that are immediately invoked and executed as soon as defined.
//this aviod global scope pollution.
//syntax
(function(a,b){         
     return a + b; 
})(10,20);
//You can also use an arrow function in defining an IIFE:
(() => {     
    //... 
})();
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #iife #javascript
ADD COMMENT
Topic
Name
4+9 =