JavaScript Reserved Keywords


Example

JavaScript has a predefined collection of reserved keywords which you cannot use as variables, labels, or function names.

ECMAScript 1

1
A — EE — RS — Z
breakexportsuper
caseextendsswitch
catchfalsethis
classfinallythrow
constfortrue
continuefunctiontry
debuggeriftypeof
defaultimportvar
deleteinvoid
donewwhile
elsenullwith
enumreturn

ECMAScript 2

Added 24 additional reserved keywords. (New additions in bold).

3E4X
A — FF — PP — Z
abstractfinalpublic
booleanfinallyreturn
breakfloatshort
byteforstatic
casefunctionsuper
catchgotoswitch
charifsynchronized
classimplementsthis
constimportthrow
continueinthrows
debuggerinstanceoftransient
defaultinttrue
deleteinterfacetry
dolongtypeof
doublenativevar
elsenewvoid
enumnullvolatile
exportpackagewhile
extendsprivatewith
falseprotected

ECMAScript 5 / 5.1

There was no change since ECMAScript 3.

ECMAScript 5 removed int, byte, char, goto, long, final, float, short, double, native, throws, boolean, abstract, volatile, transient, and synchronized; it added let and yield.

A — FF — PP — Z
breakfinallypublic
caseforreturn
catchfunctionstatic
classifsuper
constimplementsswitch
continueimportthis
debuggerinthrow
defaultinstanceoftrue
deleteinterfacetry
dolettypeof
elsenewvar
enumnullvoid
exportpackagewhile
extendsprivatewith
falseprotectedyield

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 — EE — RS — Z
breakexportsuper
caseextendsswitch
catchfinallythis
classforthrow
constfunctiontry
continueiftypeof
debuggerimportvar
defaultinvoid
deleteinstanceofwhile
donewwith
elsereturnyield

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:

implementspackagepublic
interfaceprivate`static'
letprotected

Future reserved keywords in older standards

The following are reserved as future keywords by older ECMAScript specifications (ECMAScript 1 till 3).

abstractfloatshort
booleangotosynchronized
byteinstanceofthrows
charinttransient
doublelongvolatile
finalnative

Additionally, the literals null, true, and false cannot be used as identifiers in ECMAScript.

From the Mozilla Developer Network.