What are the reserved words in javascript?

This section contains a list of all keywords that are reserved in JavaScript.

What are Reserved Keywords?

JavaScript has a number of reserved keywords. These are the words that you cannot use as identifiers (variable names, function names, and loop labels) in your JavaScript programs.

Reserved Keywords in ECMAScript 5 (ES5)

The following list shows the keywords that are reserved in ECMAScript 5. It also includes keywords that are reserved for future as well as keywords that are disallowed in strict mode.

arguments sm break case catch class fr const fr continue debugger default delete do else enum fr eval sm export fr extends fr false finally for function if implements sm import fr in instanceof interface sm let sm new null package sm private sm protected sm public sm return static sm super fr switch this throw true try typeof var void while with yield sm

Note: The keywords arguments and eval are not strictly reserved keywords, but they are treated like keywords in strict mode, so they cannot be used as identifiers. Additionally, the keywords null, true, and false cannot be used as identifiers in ECMAScript.


Reserved Keywords in ECMAScript 6 (ES6)

The following list shows the keywords that are reserved in ECMAScript 6. It also includes keywords that are reserved for future as well as keywords that are disallowed in strict mode.

arguments sm await break case catch class const continue debugger default delete do else enum fr eval sm export extends false finally for function if implements sm import in instanceof interface sm let sm new null package sm private sm protected sm public sm return static sm super switch this throw true try typeof var void while with yield


Future Reserved Keywords in Older Standards

The following list shows the keywords that were reserved as future keywords by the older ECMAScript specifications (before ECMAScript 5 or ES5).

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

Note: For optimal backwards compatibility, you should better avoid using all the keywords shown on this page as variable names or property names in your JavaScript code.

Summary

Reserved words are words that you cannot use as identifiers in JavaScript.

Syntax

Remarks

JavaScript has a number of reserved words that you cannot use as identifiers. Reserved words have a specific meaning to the JavaScript language, as they are part of the language syntax. Using a reserved word causes a compilation error when loading your script.

Notes

Future reserved words

JavaScript also has a list of future reserved words. These words are not currently part of the JavaScript language, although they are reserved for future use. For more information about future reserved keywords in JavaScript, see JavaScript Future Reserved Words.

Intrinsic objects or functions

When choosing identifiers it is also important to avoid any words that are already the names of intrinsic JavaScript objects or functions, such as String or parseInt.

Reserved Keywords

  • break
  • case
  • catch
  • continue
  • debugger
  • default
  • delete
  • do
  • else
  • finally
  • for
  • function
  • if
  • in
  • instanceof
  • new
  • return
  • switch
  • this
  • throw
  • try
  • typeof
  • var
  • void
  • while
  • with
  • yield

See also

JavaScript Future Reserved Words

Attributions

  • Microsoft Developer Network: Article

  • Beginners
  • Concepts
  • HTML
  • CSS
  • Accessibility
  • JavaScript
  • DOM
  • SVG

What are reserved words in JavaScript?

JavaScript Reserved Words.

How many reserved words are in JavaScript?

JavaScript reserved words cannot be used as identifiers. There are around 49 major keywords used as reserved words in JavaScript. These JavaScript reserved keywords are normally not used during the creation of variable names.

What are keywords reserved words?

Keywords have a special meaning in a language, and are part of the syntax. Reserved words are words that cannot be used as identifiers (variables, functions, etc.), because they are reserved by the language. In practice most keywords are reserved words and vice versa.

Is name a reserved word in JS?

Its not a javascript reserved word, its an html attribute. Any DOM element can have a name.