Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js immediately invoked function

//IIFE
//Need to wrap function in ()
(function() {
	console.log("I will only run once");
})(); //Immediately calling it.

//Arrow Function
(() => console.log("Will only run once Arrow Function"))();
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #js #immediately #invoked #function
ADD COMMENT
Topic
Name
9+4 =