//IIFEs or Immediately Invoked Function Expressions call themselves when they are declared
(function () {
console.log("IMMEDIATE INVOKED!!!");
})();
//They can be utilized to make a module to apply multiple functions to a single object at once
let giveSuperpowers = (function () {
return {
giveFly: function(obj) {
obj.Fly = function() {
console.log("You can fly now");
};
},
giveSuperStrength: function(obj) {
obj.superStrength = function() {
console.log("You have super strength now");
};
}
}
})();