Javascript: difference between using an IIFE and a block statement
14:56 25 Jul 2018

IIFE are mainly used to encapsulate scope

(function () {
    let myVar = 10; // not global
    // ...
}());

but why not just use a block statement?

{
    let myVar = 10; // also not global
    // ...
}

are there other benefits for using IIFE further than scope encapsulation?

javascript syntax scope block iife