JavaScript specifies a list of keywords that should not be used as names to identify variables, objects, and other elements in the code. In addition, a set of reserved keywords is allocated for future use. These should not be used either.
Below are the JavaScript keywords. These cannot be used as variables, functions, or object identifiers.
JavaScript Keywords | |||
---|---|---|---|
break | do | instanceof | typeof |
case | else | new | var |
catch | finally | return | void |
continue | for | switch | while |
debugger | function | this | with |
default | if | throw | |
delete | in | try |
In addition, the literals null
, true
, and false
are reserved
for their standard usage.
The EcmaScript specification has the following list of words reserved for future use. You should not use these as identifiers in your JavaScript code.
JavaScript Reserved Keywords | |||
---|---|---|---|
class | implements | package | static |
enum | import | private | super |
export | interface | protected | yield |
extends | let | public |