Lambda saysAn IIFE runs a function immediately to create a private scope.
An Immediately Invoked Function Expression — (function(){ … })() or (() => { … })() — defines and calls a function at once. Before modules, it was the way to avoid polluting the global scope and to keep variables private. Modules now cover most uses, but you'll still see IIFEs in scripts and bundles.
Power-ups you unlock
(function(){…})() runs immediately
Creates an isolated private scope
Historically avoided global pollution
Mostly superseded by modules
The Mutator attacks — common mistakes
Forgetting the wrapping parens (syntax error)
Using an IIFE where a module would be cleaner
Returning nothing when you needed the value
Boss battleWrap setup code in an IIFE so its variables stay private.