Reserved keywords
suggest changeJavaScript has a predefined collection of reserved keywords which you cannot use as variables, labels, or function names.
ECMAScript 1
| A — E | E — R | S — Z |
|---|---|---|
| break | export | super |
| case | extends | switch |
| catch | false | this |
| class | finally | throw |
| const | for | true |
| continue | function | try |
| debugger | if | typeof |
| default | import | var |
| delete | in | void |
| do | new | while |
| else | null | with |
| enum | return |
ECMAScript 2
Edition 2 did not add a new set of active keywords. The table below is the old future-reserved list, including names that were never syntax. They are not marked as additions.
| A — F | F — P | P — Z |
|---|---|---|
| abstract | final | public |
| boolean | finally | return |
| break | float | short |
| byte | for | static |
| case | function | super |
| catch | goto | switch |
| char | if | synchronized |
| class | implements | this |
| const | import | throw |
| continue | in | throws |
| debugger | instanceof | transient |
| default | int | true |
| delete | interface | try |
| do | long | typeof |
| double | native | var |
| else | new | void |
| enum | null | volatile |
| export | package | while |
| extends | private | with |
| false | protected |
ECMAScript 5 / 5.1
ECMAScript 5 removed the future-reserved names int, byte, char, goto, long, final, float, short, double, native, throws, boolean, abstract, volatile, transient, and synchronized. It added let and yield as names reserved in strict mode.
| A — F | F — P | P — Z |
|---|---|---|
| break | finally | public |
| case | for | return |
| catch | function | static |
| class | if | super |
| const | implements | switch |
| continue | import | this |
| debugger | in | throw |
| default | instanceof | true |
| delete | interface | try |
| do | let | typeof |
| else | new | var |
| enum | null | void |
| export | package | while |
| extends | private | with |
| false | protected | yield |
implements, let, private, public, interface, package, protected, static, and yield are disallowed in strict mode only.
eval and arguments are not reserved words but they act like it in strict mode.
ECMAScript 6 / ECMAScript 2015
| A — E | E — R | S — Z |
|---|---|---|
| break | export | super |
| case | extends | switch |
| catch | finally | this |
| class | for | throw |
| const | function | try |
| continue | if | typeof |
| debugger | import | var |
| default | in | void |
| delete | instanceof | while |
| do | new | with |
| else | return | yield |
Future reserved keywords
The following are reserved as future keywords by the ECMAScript specification. They have no special functionality at present, but they might at some future time, so they cannot be used as identifiers.
enum
The following are only reserved when they are found in strict mode code:
| implements | package | public |
|---|---|---|
| interface | private | static |
| let | protected |
Future reserved keywords in older standards
The following were future-reserved in early editions. instanceof has been a real operator since ECMAScript 3, so it is not an unused future word.
| abstract | float | short |
|---|---|---|
| boolean | goto | synchronized |
| byte | instanceof | throws |
| char | int | transient |
| double | long | volatile |
| final | native |
Additionally, the literals null, true, and false cannot be used as identifiers. await is reserved inside modules. yield is reserved inside generators, and let is reserved in strict mode.