why do we need iife function javascript code example
Example 1: immediate invoke function js
(function () {
statements
})();
Example 2: iife
/*An IIFE (Immediately Invoked Function Expression) is a JavaScript
function that runs as soon as it is defined
*/
(function () {
//write your js code here
});