ife in js code example
Example 1: iife javascript
var result = (function () {
var name = "Barry";
return name;
})();
// Immediately creates the output:
result; // "Barry"
Example 2: javascript Immediately Invoked Function Expression
result = (function(a, b){
return a - b;
})(100, 42);
console.log(result); // 58