From what I understand, the answer is "yes." But assuming that's true, how is it possible?

Wouldn't it violate the WHATWG's design principle #2.1? I mean, let's assume that the keyword foo was added as a keyword in ECMA-262. wouldn't code that was written and deployed years ago, and that potentially uses foo as an identifier totally break?

Maybe I'm just wrong and the answer is no. That said, I really have no choice but to ask on here, since googling for "new javascript keyword" or any variation on the query unsurprisingly yields a ton of crap about, well, the new javascript keyword.

有帮助吗?

解决方案

No, you as a developer can not define new keywords that are not part of the specification.

Yes, the standards board could add new keywords or reserved words, but generally they avoid doing so for the breakage reason you state.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top