Blocks description is misleading
Author: togakangarooCreated Dec 21, 2016Updated Feb 7, 2018
Blocks have been in js for a long time - they’re the reason
return
{
foo: 123
}breaks since it is interpreted as
return undefined;
{ //block
foo: //label
123; //expression
}That being said, blocks haven’t been very useful before due to lack of block scope, but that’s not different than the earlier discussion of let and const
Blocks don’t really do the same thing as IIFEs in enough situations to call then replacements I think. They will not limit var declarations, but more importantly they won't limit function declarations which will be hoisted into a higher scope
Source: DrkSephy/es6-cheatsheet