3 ms·
> very easily and completely backwards compatibly. Object literals, blocks, and ASI take that out of the realm of "very easily": var x = if (c) {} else { b
by munificent 6y ago
> very easily and completely backwards compatibly.
Object literals, blocks, and ASI take that out of the realm of "very easily":
var x = if (c) {} else { b: console.log("hi") }
If `c` is true, does this give you `null` from executing an empty block, or an empty object? If `c` is `false`, do you get an object with key "b" and value whatever `log()` returns, or is that a block with a labeled statement?
- MHordecki 6y agoThis specific problem was already dealt with during the introduction of arrow functions[1]. It makes sense to keep the same parsing semantics. [1]: https://www.ecma-international.org/ecma-262/11.0/index.html#prod-ConciseBody https://www.ecma-international.org/ecma-262/11.0/index.html#...