Self Invoking Function(JavaScript)
Mheyrie
Posted on February 2, 2024
A self-invoking function, also known as an Immediately Invoked Function Expression (IIFE), is a JavaScript function that runs automatically as soon as it's defined. This pattern is commonly used for creating a private scope, preventing variable name clashes, and managing dependencies. example of how to write IIFE
`(function(){
console.log("Hello, I am self Involving function")
})();`
things to note:
- IIFE are wrapped in ()
- IIFE ends with a full ()
💖 💪 🙅 🚩
Mheyrie
Posted on February 2, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.