Description

The keywords are the reserved words that are part of the syntax in a programming language.

  • Keywords are reserved words.
  • Keywords cannot be used to name identifiers.
  • An identifier is a name that is given to entities like variables, properties, functions, classes, etc.

For backward compatibility, we should better avoid using all the keywords to name identifiers in JavaScript code.

Example

In the below example, the word var is a keyword and the word greet is an identifier.

var greet = 'Hello World';

Keywords in ECMAScript 5 (ES5)

The below list contains the keywords that are reserved in ECMAScript 5.

The list also includes keywords "reserved for future" as well as keywords that are "disallowed in strict mode".

arguments enum instanceof switch
break eval interface this
case export let throw
catch extends new true
class false null try
const finally package typeof
continue for private var
debugger function protected void
default if public while
delete implements return with
do import static yield
else in super  

Keywords in ECMAScript 6 (ES6)

The below list contains the keywords that are reserved in ECMAScript 6.

The list also includes keywords "reserved for future" as well as keywords that are "disallowed in strict mode".

arguments else in super
await enum instanceof switch
break eval interface this
case export let throw
catch extends new true
class false null try
const finally package typeof
continue for private var
debugger function protected void
default if public while
delete implements return with
do import static yield

Future Reserved Keywords

The below list contains the keywords that are "reserved for future" by older specifications, before ECMAScript 5.

abstract double int synchronized
boolean final long throws
byte float native transient
char goto short volatile

Overall

JavaScript Keywords are reserved words that cannot be used to name identifiers within a JavaScript code.

Related Links