IIFE in Es6 with example

IIFE

Abbrevation of IIFE is Immediately Invoked Function Expression ,  IIFE is a Self Executing Anonymous Function , Immediately Invoked Function Expression will be available as soon as it runs

  Here is a syntax for IIFE below
 
    (function () {
        //code here
    })();
   
   
   
   
    Here is an example , i am trying to question a list of multibagger stocks and i want this to be printed in the console as soon as it is created , so
     a variable is created called as  multiBaggerStocks and string is assigned to the variable "Do you know  the list of multibagger stocks ??  Can you comment in the below Section ". As soon as the Anonymous function is created the the value is being printed on the screen
   
    (
        function () {
            multiBaggerStocks ="Do you know  the list of multibagger stocks ??  Can you comment in the below Section " ;
            console.log(multiBaggerStocks)
        }
    )();
   
   
    Output will be  : Do you know  the list of multibagger stocks ??  Can you comment in the below Section

IIFE  in Es6 with example

Comments