Javascript-IIFE-(3)

 


πŸ‘‰IIFE


✅Immediately invoked function expression

IIFE is used when you want to create the function and at the same time, if you want to invoke the function.

Since you don't want to invoke the function later in the script, it's not required to give a name to the function. 

This function gets created and executed right away. This is also termed an anonymous function.

To generalize,  IIFE is used when you want to execute start-up code in the script, or code is specific to that page, or code is for one-time use and not used anywhere else in the script.

(function () {alert ("hi"); } () );

Comments

Popular posts from this blog

SQL-ForeignKeyConstraint-Page6

Javascript-OOPs(Part3)-Inheritance - (9)

OraclePLSQL-Page3