what are immediately invoked function used for javascript code example
Example 1: immediate invoke function js
(function () {
statements
})();
Example 2: javascript Immediately Invoked Function Expression
result = (function(a, b){
return a - b;
})(100, 42);
console.log(result); // 58