what is iife in javascript code example
Example 1: javascript Immediately Invoked Function Expression
result = (function(a, b){
return a - b;
})(100, 42);
console.log(result);
Example 2: iife javascript
var result = (function () {
var name = "Barry";
return name;
})();
result;
Example 3: immediate invoke function js
(() => {
})();
Example 4: immediately invoked function expression
(function () {
statements
})();
Example 5: immediately invoked function expression
(function () {
var aName = "Barry";
})();
aName
Example 6: iife
(function () {
});