JavaScript TutorialDatatypes in JavaScriptEvaluating JavaScriptFunctional JavaScriptJavaScript .postMessage() and MessageEventJavaScript AJAXJavaScript Anti-patternsJavaScript Arithmetic (Math)JavaScript ArraysJavaScript Arrow FunctionsJavaScript Async functions (async/await)JavaScript Async IteratorsJavaScript Automatic Semicolon Insertion - ASIJavaScript Battery Status APIJavaScript Behavioral Design PatternsJavaScript Binary DataJavaScript Bitwise operatorsJavaScript Bitwise Operators - Real World Examples (snippets)JavaScript BOM (Browser Object Model)JavaScript Built-in ConstantsJavaScript CallbacksJavaScript ClassesJavaScript CommentsJavaScript Comparison OperationsJavaScript ConditionsJavaScript ConsoleJavaScript Constructor functionsJavaScript Context (this)JavaScript CookiesJavaScript Creational Design PatternsJavaScript Custom ElementsJavaScript Data attributesJavaScript Data ManipulationJavaScript DateJavaScript Date ComparisonJavaScript DebuggingJavaScript Declarations and AssignmentsJavaScript Destructuring assignmentJavaScript Detecting browserJavaScript EnumerationsJavaScript Error HandlingJavaScript Escape SequencesJavaScript EventsJavaScript execCommand and contenteditableJavaScript FetchJavaScript File API, Blobs and FileReadersJavaScript Fluent APIJavaScript FunctionsJavaScript GeneratorsJavaScript GeolocationJavaScript Global error handling in browsersJavaScript HistoryJavaScript How to make iterator usable inside async callback functionJavaScript IndexedDBJavaScript InheritanceJavaScript Intervals and TimeoutsJavaScript JSONJavaScript Linters - Ensuring code qualityJavaScript LocalizationJavaScript LoopsJavaScript MapJavaScript Memory efficiencyJavaScript Method ChainingJavaScript Modals - PromptsJavaScript Modularization TechniquesJavaScript ModulesJavaScript NamespacingJavaScript Navigator ObjectJavaScript Notifications APIJavaScript ObjectsJavaScript Performance TipsJavaScript PromisesJavaScript Prototypes, objectsJavaScript ProxyJavaScript Regular expressionsJavaScript requestAnimationFrameJavaScript Reserved KeywordsJavaScript Same Origin Policy & Cross-Origin CommunicationJavaScript ScopeJavaScript ScreenJavaScript Security issuesJavaScript Selection APIJavaScript Server-sent eventsJavaScript SetJavaScript Setters and GettersJavaScript Strict modeJavaScript StringsJavaScript SymbolsJavaScript Tail Call OptimizationJavaScript Template Literals

JavaScript Reserved Keywords

From WikiOD

Certain words - so-called keywords - are treated specially in JavaScript. There's a plethora of different kinds of keywords, and they have changed in different versions of the language.

Reserved Keywords[edit | edit source]

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

ECMAScript 1[edit | edit source]


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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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.


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.

From the Mozilla Developer Network.

Identifiers & Identifier Names[edit | edit source]

With regards to reserved words there is a small distinctions between the "Identifiers" used for the likes of variable or function names and the "Identifier Names" allowed as properties of composite data types.

For example the following will result in an illegal syntax error:

var break = true;

Uncaught SyntaxError: Unexpected token break

However the name is deemed valid as a property of an object (as of ECMAScript 5+):

var obj = {
    break: true

To quote from this answer:

From the ECMAScript® 5.1 Language Specification:

Section 7.6

Identifier Names are tokens that are interpreted according to the grammar given in the “Identifiers” section of chapter 5 of the Unicode standard, with some small modifications. An Identifier is an IdentifierName that is not a ReservedWord (see 7.6.1).


Identifier ::
  IdentifierName but not ReservedWord

By specification, a ReservedWord is:

Section 7.6.1

A reserved word is an IdentifierName that cannot be used as an Identifier.

ReservedWord :: 

This includes keywords, future keywords, null, and boolean literals. The full list of keywords are in Sections 7.6.1 and literals are in Section 7.8.

The above (Section 7.6) implies that IdentifierNames can be ReservedWords, and from the specification for object initializers:

Section 11.1.5


ObjectLiteral :
  { }
  { PropertyNameAndValueList }
  { PropertyNameAndValueList , }

Where PropertyName is, by specification:

PropertyName :

As you can see, a PropertyName may be an IdentifierName, thus allowing ReservedWords to be PropertyNames. That conclusively tells us that, by specification, it is allowed to have ReservedWords such as class and var as PropertyNames unquoted just like string literals or numeric literals.

To read more, see Section 7.6 - Identifier Names and Identifiers.

Note: the syntax highlighter in this example has spotted the reserved word and still highlighted it. While the example is valid Javascript developers can get caught out by some compiler / transpiler, linter and minifier tools that argue otherwise.