Keyword and reserved word collation in Javascript

  • 2020-03-30 04:09:49
  • OfStack

Ecma-262 describes a set of keywords with a specific purpose, which can be used to indicate the beginning or end of a control statement, or to perform a specific operation, etc. Rule: keywords are language reserved and cannot be used as identifiers.

All ECMAScript keywords (* new for version 5) :

Breakdoinstanceoftypeofcaseelsenewvarcatchfinallyreturnvoidcontinueforswitchwhiledebugger *   functionthiswithdefaultifthrowdeleteintry

All reserved words in ecma-262 (3rd edition) :

abstractenumintshortbooleanexportinterfacestaticbyteextendslongsupercharfinalnativeclass

synchronizedfloatpackagethrowsconstgotoprivatetransientdebuggerimplementsprotectedvolatiledouble

importpublic

The reserved word may be used as a key in reeditions, such as the new debugger in version 5, which is the third edition reserved word.

Reserved words in non-strict mode in the fifth edition:

classenumextendssupperconstexportimport

Reserved words in strict mode:

implementspackagepublicinterfaceprivatestaticletprotectedyield

Note: let and yield are new reserved words; Reserved words for reference to ensure compatibility.

Using keywords and reserved words in Javascript causes errors. Not recommended!


Related articles: