Self Invoking Function(JavaScript)

mheyrie

Mheyrie

Posted on February 2, 2024

Self Invoking Function(JavaScript)

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")
})();`
Enter fullscreen mode Exit fullscreen mode

things to note:

  • IIFE are wrapped in ()
  • IIFE ends with a full ()
💖 💪 🙅 🚩
mheyrie
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.

Related