Description
JavaScript Reserved Keywords are the words that cannot be used as identifiers within a JavaScript code or program.
- A JavaScript identifier can be a variable name, function name, loop label, etc.,
For backward compatibility, we should better avoid using all the reserved keywords either as variable names or property names in JavaScript code.
Reserved 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 |
Reserved 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
We now know the list of all the JavaScript reserved keywords that cannot be used as identifiers within a JavaScript code.
Related Links
- JavaScript Tutorial
- JavaScript Examples