DEV Community

Beto Muniz
Beto Muniz

Posted on • Edited on • Originally published at betomuniz.com

1 1 1 1 1

What are IIFE or Immediate Functions on JavaScript?

😁 IIFE or Immediately-invoked Functions Expressions is a design pattern that runs functions as soon as such functions are created on its runtime environment.

😎 In general, IIFE's are related to the desire to not pollute the global object and/or to isolate business logics.

;(function thisIsANamedIIFE() { 
    let name = "Beto Muniz";
})();
Enter fullscreen mode Exit fullscreen mode

😋 This pattern is used a lot for library creators. Even Rollup.js, which is a good bundler for libraries offer this output.

Top comments (0)

SurveyJS custom survey software

JavaScript Form Builder UI Component

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

Learn more