xxxxxxxxxx
result = (function(a, b){
return a - b;
})(100, 42);
console.log(result); // 58
xxxxxxxxxx
(function () {
var aName = "Barry";
})();
// Variable aName is not accessible from the outside scope
aName // throws "Uncaught ReferenceError: aName is not defined"
xxxxxxxxxx
//IIFE
//Need to wrap function in ()
(function() {
console.log("I will only run once");
})(); //Immediately calling it.
//Arrow Function
(() => console.log("Will only run once Arrow Function"))();