JavaScript Reserved Words

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.)

  • await
  • break
  • case
  • catch
  • class
  • const
  • continue
  • debugger
  • default
  • delete
  • do
  • else
  • enum
  • export
  • extends
  • false
  • finally
  • for
  • function
  • if
  • import
  • in
  • instanceof
  • new
  • null
  • return
  • super
  • switch
  • this
  • throw
  • true
  • try
  • typeof
  • var
  • void
  • while
  • with
  • yield

Strict Mode Reserved Words (Additional restrictions in strict mode)

  • implements
  • interface
  • let
  • package
  • private
  • protected
  • public
  • static
  • yield

Future Reserved Words (Potentially reserved for future use)

  • abstract
  • boolean
  • byte
  • char
  • double
  • final
  • float
  • goto
  • int
  • long
  • native
  • short
  • synchronized
  • transient
  • volatile

Important Notes:

  1. 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.
  2. Case Sensitivity: JavaScript is case-sensitive, so reserved words must be used in the exact case as defined. For example, var is reserved, but Var is not.
  3. 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.