JavaScript Keywords & Reserved Words

JavaScript Keywords have a special meaning in the context of a language. They are part of the syntax of JavaScript. These are reserved words and we cannot use them as JavaScript Identifier names. Using them will result in a compile error.

List of Reserved Words

Reserved Words
arguments***await**break
casecatchclass
constcontinuedebugger
defaultdeletedo
elseenumexport
extendsfalse*finally
forfunctionget***
ifimportin
instanceofnewnull*
returnset***super
switchthisthrow
true*trytypeof
varvoidwhile
withyield

* The nulltrue, and false are not keywords but literals, but we cannot use them as identifiers as they have special meaning.

** We cannot use await only when we use it inside a Module.

*** arguments, get, set are not keywords, but they do have special meaning in some contexts. Hence better avoid them

List of Strict Mode Reserved Words

You cannot use the following reserved keywords only if you enable strict mode.

For Example

The following works although we used let as the variable name.

But enabling the strict mode will result in an error.

The following is a list of strict mode-only reserve words.

Strict Mode Reserved Words
argumentsevalimplements
interfaceletpackage
privateprotectedpublic
staticyield

Future Reserved Words

The following keywords do not have any special meaning now. But they may be used in some times in the future. Hence they cannot be used as identifiers.

Reserved Words
abstractbooleanbyte
chardoublefinal
floatgotoint
longnativeshort
synchronizedthrowstransient
volatile

Other Keywords that you must avoid

The NaNInfinity, and undefined are not reserved keywords in JavaScript But you must avoid using them. They are properties of the global object and have special meanings. Although they are immutable & read-only properties, JavaScript does not throw any errors if you declare them in the global scope.

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top