JavaScript/Reserved words

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Previous: Automatic semicolon insertion Index Next: Variables and types

This page contains a list of reserved words in JavaScript, which cannot be used as names of variables, functions or other objects.

Reserved words used in JavaScript[edit | edit source]

Current list of keywords used in JavaScript Version 5.1:[1][2]

abstract arguments boolean break byte
case catch char class* const
continue debugger default delete do
double else enum* eval export*
extends* final finally float for
function goto if implements import*
in instanceof int interface let
long native new package private
protected public return short static
super* switch synchronized this throw
throws transient try typeof var
void volatile while with yield

(*) new reserved words in ECMAScript5

A few other reserved words used in JavaScript represent literal values:[1]

false null true

Words reserved for JavaScript in the future[edit | edit source]

Some words have been reserved according to the ECMAScript specification so that they cannot be used as variable names, although currently, they do not have any functionality. These keywords may or may not be reserved words for some ECMAScript specification, and are grouped according to their condition of being reserved.[3]

Words that are always reserved[edit | edit source]

await enum

Words that are reserved in strict mode[edit | edit source]

implements private static
interface protected
package public

Words that were reserved in ECMAScript standards 1-3[edit | edit source]

abstract[citation needed] extends native[citation needed]
boolean[citation needed] final[citation needed] short[citation needed]
byte[citation needed] float[citation needed] super
char[citation needed] goto[citation needed] synchronized[citation needed]
class import throws[citation needed]
const int[citation needed] transient[citation needed]
double[citation needed] let volatile[citation needed]
export long[citation needed]

References[edit | edit source]

  1. a b "ECMA-262 5.1: ECMAScript Language Specification" 2011, Section 7.6.1: Reserved Words, (keywords, the two Boolean literals, the null literal, and future reserved words).
  2. "JavaScript Reserved Words". Retrieved 2016-05-24. 
Previous: Automatic semicolon insertion Index Next: Variables and types