Blocks have been in js for a long time - they’re the reason
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
Blocks have been in js for a long time - they’re the reason
breaks since it is interpreted as
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
letandconstBlocks don’t really do the same thing as IIFEs in enough situations to call then replacements I think. They will not limit
vardeclarations, but more importantly they won't limitfunctiondeclarations which will be hoisted into a higher scope