Arun Jacob
1 min readMay 15, 2020

--

Thank you Rishi. It was easy to understand and try it out.

If your function accepts parameters they go into an additional pair of parenthesis at the end of the IIFE.

Regarding the above, kindly check whether we still need paranthesis at the end of IIFE.

Option 1:without paranthesis, will output the function definition

(function () {
console.log(“Your js code goes here”);
});

output
ƒ () {

console.log(“Your js code goes here”);
}

Option 2: With paranthesis, will output the expected lines
(function () {
console.log(“Your js code goes here”);
})();

output
Your js code goes here

Regards,

Jakes

--

--

Arun Jacob
Arun Jacob

Written by Arun Jacob

Tech. Enthusiast, develops user journeys for SAP Enterprise Applications.

Responses (1)