Natychmiastowe funkcje wywołujące js
(() => {
// statements
})();
Programming Bird
(() => {
// statements
})();
var result = (function () {
var name = "Barry";
return name;
})();
// Immediately creates the output:
result; // "Barry"
//IIFE, aka, 'Immediately Invoked Function Expression'
//The syntax for defining an IIFE can be seen in the following example:
(function(a,b){
return a + b;
})(10,20);
//You can also use an arrow function in defining an IIFE:
(() => {
//...
})();
(function() {
/* */
})()