js immediately envoked function code example
Example 1: immediate invoke function js
(() => {
// statements
})();
Example 2: immediately invoked function expression
(function () {
statements
})();
Example 3: immediately invoked function expression
(function () {
var aName = "Barry";
})();
// Variable aName is not accessible from the outside scope
aName // throws "Uncaught ReferenceError: aName is not defined"