Open Playground
JS TutorialLesson #128

JavaScript Reserved Words

In JavaScript you cannot use these reserved words as variables, labels, or

In JavaScript you cannot use these reserved words as variables, labels, or function names:

abstractargumentsasync *await *
booleanbreakbytecase
catchcharclass *const *
continuedebuggerdefaultdelete
dodoubleelseenum *
evalexport *extends *false
finalfinallyfloatfor
functiongotoifimplements
functionimport *ininstanceof
intinterfacelet *long
nativenewnullpackage
privateprotectedpublic *return
shortstatic *super *switch
synchronizedthisthrowthrows
transienttruetrytypeof
using *varvoidvolatile
whilewithyield *
Words marked with* have been added to JavaScript from after 2015. > You can read more the newest JavaScript versions in JS News 2025-2015.

Share

Removed Reserved Words

The following reserved words was removed from the ECMAScript 5/6 standard:

abstractbooleanbytechar
doublefinalfloatgoto
intlongnativeshort
synchronizedthrowstransientvolatile

JavaScript Objects, Properties, and Methods

You should also avoid using the name of JavaScript built-in objects, properties, and methods:

ArrayDateevalfunction
hasOwnPropertyInfinityisFiniteisNaN
isPrototypeOflengthMathNaN
nameNumberObjectprototype
StringtoStringundefinedvalueOf

Java Reserved Words

JavaScript is often used together with Java. You should avoid using some Java objects and properties as JavaScript identifiers:

getClassjavaJavaArrayjavaClass
JavaObjectJavaPackage

Other Reserved Words

JavaScript can be used as the programming language in many applications.

You should also avoid using the name of HTML and Window objects and properties:

alertallanchoranchors
areaassignblurbutton
checkboxclearIntervalclearTimeoutclientInformation
closeclosedconfirmconstructor
cryptodecodeURIdecodeURIComponentdefaultStatus
documentelementelementsembed
embedsencodeURIencodeURIComponentescape
eventfileUploadfocusform
formsframeinnerHeightinnerWidth
layerlayerslinklocation
mimeTypesnavigatenavigatorframes
frameRatehiddenhistoryimage
imagesoffscreenBufferingopenopener
optionouterHeightouterWidthpackages
pageXOffsetpageYOffsetparentparseFloat
parseIntpasswordpkcs11plugin
promptpropertyIsEnumradioreset
screenXscreenYscrollsecure
selectselfsetIntervalsetTimeout
statussubmittainttext
textareatopunescapeuntaint
window

HTML Event Handlers

In addition you should avoid using the name of all HTML event handlers.

Examples:

onbluronclickonerroronfocus
onkeydownonkeypressonkeyuponmouseover
onloadonmouseuponmousedownonsubmit