JavaScript has a set of reserved words that have special meanings in the language syntax. These words cannot be used as identifiers (such as variable names, function names, or any other identifier).
List of Reserved Words:
Keywords (Cannot be used for variable names, functions, etc.)
awaitbreakcasecatchclassconstcontinuedebuggerdefaultdeletedoelseenumexportextendsfalsefinallyforfunctionifimportininstanceofnewnullreturnsuperswitchthisthrowtruetrytypeofvarvoidwhilewithyield
Strict Mode Reserved Words (Additional restrictions in strict mode)
implementsinterfaceletpackageprivateprotectedpublicstaticyield
Future Reserved Words (Potentially reserved for future use)
abstractbooleanbytechardoublefinalfloatgotointlongnativeshortsynchronizedtransientvolatile
Important Notes:
- Strict Mode: Using certain reserved words in strict mode (
'use strict';) can throw errors. It is recommended to avoid these words even outside strict mode to ensure forward compatibility. - Case Sensitivity: JavaScript is case-sensitive, so reserved words must be used in the exact case as defined. For example,
varis reserved, butVaris not. - Best Practices: Avoid using any words that are reserved or may become reserved in future versions of JavaScript to prevent potential conflicts and ensure code maintainability.
By adhering to these rules, you can avoid syntax errors and ensure that your code adheres to JavaScript standards.