its to prevent the IIFE opening and closing parenthesis to act as a function call for the previous statement which will throw an error
let statement_1 = () => console.log("whatever");
statement_1()
(() => {
console.log("haha")
})()
this will throw an error, statement_1(...) is not a function
but you might say it is a function, so why the error?
statement_1() // this statement executes that anonymous function, and returns nothing,
and the opening and closing ( parenthesis ) of the IIFE will make it look like its a function call for the return value of the above statement so it will actually look like
statement_1()( ()=>{ .. } )() // the outer IIFE parenthesis is now acting as function call syntax for return value of statement_1()
so it'll try to call the returned value from statement_1() as a function, so it will cause all loads of bugs and errors, to fix this we manually state the end of the first statement with a semicolon, this way the JavaScript engine doesn't get confused and can differentiate between the two statements properly
statement_1();
( () => {}) ()
TL;DR use semicolons more often.
in the post they just placed the semicolon at the beginning of the IIFE rather than end of first statement.