mozilla

Revision 76028 of Reserved Words

  • Revision slug: JavaScript/Reference/Reserved_Words
  • Revision title: Reserved Words
  • Revision id: 76028
  • Created:
  • Creator: Eric Wieser
  • Is current revision? No
  • Comment one or more formatting changes

Revision Content

The following are keywords and may not be used as variables, functions, methods, or object identifiers, because ECMAScript specifies special behavior for them:

Future reserved words

The following are reserved as future keywords by the ECMAScript specification.  They have no special functionality at present, but they might at some future time, so they cannot be used as identifiers.  (Note that for the moment Mozilla reserves these keywords only in strict mode code.  Most other browsers reserve these keywords in all code, whether strict or not, so their use is very much non-portable.  Mozilla will likely reserve these keywords in normal code in a future release, to conform to the specification and to be consistent with other browsers).

{{ gecko_minversion_header("2.1") }}

Note: Starting in JavaScript 1.9 (Firefox 5), these will be reserved even when not in strict mode. NOTE: JavaScript version number here is not official.

The following are reserved as future keywords by the ECMAScript specification when they are found in strict mode code, except that let and yield have their traditional Mozilla-specific functionality in code compiled as JavaScript 1.7 or greater:

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

Note that while const is reserved as a future keyword by the ECMAScript specification, Mozilla and most other browsers implement it as a non-standard extension that may be standardized in a future version of ECMAScript.  Further, export and import were once implemented in Mozilla but have returned to reserved status in recent releases.

Additionally, the literals null, true, and false are reserved in ECMAScript for their normal uses.

{{ languages( { "es": "es/Referencia_de_JavaScript_1.5/Palabras_Reservadas", "fr": "fr/R\u00e9f\u00e9rence_de_JavaScript_1.5_Core/Mots_r\u00e9serv\u00e9s", "ja": "ja/Core_JavaScript_1.5_Reference/Reserved_Words", "pl": "pl/Dokumentacja_j\u0119zyka_JavaScript_1.5/S\u0142owa_zarezerwowane" } ) }}

Revision Source

<p>The following are keywords and may not be used as variables, functions, methods, or object identifiers, because <a href="/en/ECMAScript" title="en/ECMAScript">ECMAScript</a> specifies special behavior for them:</p>
<ul> <li><a href="/en/JavaScript/Reference/Statements/break" title="en/JavaScript/Reference/Statements/break">break</a></li> <li><a href="/en/JavaScript/Reference/Statements/switch" title="en/JavaScript/Reference/Statements/switch">case</a></li> <li><a href="/en/JavaScript/Reference/Statements/try...catch" title="en/JavaScript/Reference/Statements/try...catch">catch</a></li> <li><a href="/en/JavaScript/Reference/Statements/continue" title="en/JavaScript/Reference/Statements/continue">continue</a></li> <li><a href="/en/JavaScript/Reference/Statements/debugger" title="en/JavaScript/Reference/Statements/debugger">debugger</a></li> <li><a href="/en/JavaScript/Reference/Statements/switch" title="en/JavaScript/Reference/Statements/switch">default</a></li> <li><a href="/en/JavaScript/Reference/Operators/Special/delete" title="en/JavaScript/Reference/Operators/Special/delete">delete</a></li> <li><a href="/en/JavaScript/Reference/Statements/do...while" title="en/JavaScript/Reference/Statements/do...while">do</a></li> <li><a href="/en/JavaScript/Reference/Statements/if...else" title="en/JavaScript/Reference/Statements/if...else">else</a></li> <li><a href="/en/JavaScript/Reference/Statements/try...catch" title="en/JavaScript/Reference/Statements/try...catch">finally</a></li> <li><a href="/en/JavaScript/Reference/Statements/for" title="en/JavaScript/Reference/Statements/for">for</a></li> <li><a href="/en/JavaScript/Reference/Statements/function" title="en/JavaScript/Reference/Statements/function">function</a></li> <li><a href="/en/JavaScript/Reference/Statements/if...else" title="en/JavaScript/Reference/Statements/if...else">if</a></li> <li><a href="/en/JavaScript/Reference/Statements/for...in" title="en/JavaScript/Reference/Statements/for...in">in</a></li> <li><a href="/en/JavaScript/Reference/Operators/Special/instanceof" title="en/JavaScript/Reference/Operators/Special/instanceof">instanceof</a></li> <li><a href="/en/JavaScript/Reference/Operators/Special/new" title="en/JavaScript/Reference/Operators/Special/new">new</a></li> <li><a href="/en/JavaScript/Reference/Statements/return" title="en/JavaScript/Reference/Statements/return">return</a></li> <li><a href="/en/JavaScript/Reference/Statements/switch" title="en/JavaScript/Reference/Statements/switch">switch</a></li> <li><a href="/en/JavaScript/Reference/Operators/Special/this" title="en/JavaScript/Reference/Operators/Special/this">this</a></li> <li><a href="/en/JavaScript/Reference/Statements/throw" title="en/JavaScript/Reference/Statements/throw">throw</a></li> <li><a href="/en/JavaScript/Reference/Statements/try...catch" title="en/JavaScript/Reference/Statements/try...catch">try</a></li> <li><a href="/en/JavaScript/Reference/Operators/Special/typeof" title="en/JavaScript/Reference/Operators/Special/typeof">typeof</a></li> <li><a href="/en/JavaScript/Reference/Statements/var" title="en/JavaScript/Reference/Statements/var">var</a></li> <li><a href="/en/JavaScript/Reference/Operators/Special/void" title="en/JavaScript/Reference/Operators/Special/void">void</a></li> <li><a href="/en/JavaScript/Reference/Statements/while" title="en/JavaScript/Reference/Statements/while">while</a></li> <li><a href="/en/JavaScript/Reference/Statements/with" title="en/JavaScript/Reference/Statements/with">with</a></li>
</ul>
<h2>Future reserved words</h2>
<p>The following are reserved as future keywords by the ECMAScript specification.  They have no special functionality at present, but they might at some future time, so they cannot be used as identifiers.  (Note that for the moment Mozilla reserves these keywords only in <a href="/en/JavaScript/Strict_mode" title="en/JavaScript/Strict mode">strict mode code</a>.  Most other browsers reserve these keywords in all code, whether strict or not, so their use is very much non-portable.  Mozilla will likely reserve these keywords in normal code in a future release, to conform to the specification and to be consistent with other browsers).</p>
<p>{{ gecko_minversion_header("2.1") }}</p>
<div class="note"><strong>Note: </strong>Starting in JavaScript 1.9 (Firefox 5), these will be reserved even when not in strict mode. <strong>NOTE: JavaScript version number here is not official.</strong></div>
<ul> <li>class</li> <li>enum</li> <li><a href="/en/JavaScript/Reference/Statements/export" title="en/JavaScript/Reference/Statements/export">export</a></li> <li>extends</li> <li><a href="/en/JavaScript/Reference/Statements/import" title="en/JavaScript/Reference/Statements/import">import</a></li> <li>super</li>
</ul>
<p>The following are reserved as future keywords by the ECMAScript specification when they are found in <a href="/en/JavaScript/Strict_mode" title="en/JavaScript/Strict mode">strict mode code</a>, except that <code>let</code> and <code>yield</code> have their traditional Mozilla-specific functionality in code compiled as JavaScript 1.7 or greater:</p>
<ul> <li>implements</li> <li>interface</li> <li><a href="/JavaScript/Reference/Statements/let" title="JavaScript/Reference/Statements/let">let</a></li> <li>package</li> <li>private</li> <li>protected</li> <li>public</li> <li>static</li> <li><a href="/en/JavaScript/Reference/Statements/yield" title="en/JavaScript/Reference/Statements/yield">yield</a></li>
</ul>
<p>Note that while <a href="/en/JavaScript/Reference/Statements/const" title="en/JavaScript/Reference/Statements/const">const</a> is reserved as a future keyword by the ECMAScript specification, Mozilla and most other browsers implement it as a non-standard extension that may be standardized in a future version of ECMAScript.  Further, <a href="/en/JavaScript/Reference/Statements/export" title="en/JavaScript/Reference/Statements/export">export</a> and <a href="/en/JavaScript/Reference/Statements/import" title="en/JavaScript/Reference/Statements/import">import</a> were once implemented in Mozilla but have returned to reserved status in recent releases.</p>
<p>Additionally, the literals <code>null</code>, <code>true</code>, and <code>false</code> are reserved in ECMAScript for their normal uses.</p>
<p>{{ languages( { "es": "es/Referencia_de_JavaScript_1.5/Palabras_Reservadas", "fr": "fr/R\u00e9f\u00e9rence_de_JavaScript_1.5_Core/Mots_r\u00e9serv\u00e9s", "ja": "ja/Core_JavaScript_1.5_Reference/Reserved_Words", "pl": "pl/Dokumentacja_j\u0119zyka_JavaScript_1.5/S\u0142owa_zarezerwowane" } ) }}</p>
Revert to this revision