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
Added 24 additional reserved keywords. (New additions in bold).
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
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 — 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 are reserved as future keywords by older ECMAScript specifications (ECMAScript 1 till 3).
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 in ECMAScript.