iife example js
Example 1: javascript Immediately Invoked Function Expression
result = (function(a, b){
return a - b;
})(100, 42);
console.log(result); // 58
Example 2: immediate invoke function js
(() => {
// statements
})();
result = (function(a, b){
return a - b;
})(100, 42);
console.log(result); // 58
(() => {
// statements
})();