-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
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
Metadata
Metadata
Assignees
Labels
No labels