What are the precise semantics of block-level functions in ES6?

前端 未结 2 2121
闹比i
闹比i 2020-11-22 01:45

I\'m trying to wrap my head around the new standardized block-level functions in ES6 by reading the raw spec. My superficial understanding was:

  • Block-level fun
2条回答
  •  旧时难觅i
    2020-11-22 02:13

    I'm not sure where your confusion comes from. According to 10.2.1 it's very clear what is or isn't "in strict mode". In your sample, foos [[Strict]] internal slot would be true indeed and will be in strict mode, but the block hosting it will not. The first sentence (the one you quoted) relates to the hosting block, not the content generated within it. The block in your fragment is not in strict mode and hence that section applies to it.

提交回复
热议问题