Skip to content

Blocks description is misleading #84

Description

@togakangaroo

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions