DEV Community

Discussion on: What is IIFE in JavaScript?

Collapse
 
theoutlander profile image
Nick Karnik

Most people might not know this but if you are accustomed to not using semicolons you will run into cryptic runtime errors when using an IIFE. The solution is to always put a semicolon before an IIFE ;(() => {})()

Collapse
 
scriptingjs profile image
scriptingjs

I think semicolon is voluntary or best practice reason is if statement was not completed from previous code or semicolon do the job so we worry about our function only.