#Characteristics#
- IIFE is not reusable as it is not assigned to a variable
- You can obtain data privacy and not be impacted from outside scope.
// IIFE
function game() {
var score = Math.random() * 10;
console.log(score >= 5);
}
game();
(function() {
var score = Math.random() * 10;
console.log(score >= 5);
})();
(function(goodLuck) {
var score = Math.random() * 10;
console.log(score >= 5 - goodLuck);
})(5);