Gentoo Wiki


This page is a candidate for deletion 
Reason given: Off-topic. Orphaned article. Refer to dedicated Javascript documentation (eg. Mozilla Dev Center).
If you disagree with its deletion, please explain why on its discussion page.
If you intend to fix it, please remove this notice, but do not remove this notice from articles that you have created yourself.
Make sure no other pages link here and check the page's history before deleting.

ECMAScript Keywords and Reserved Words

ECMA-262 describes a set of keywords that ECMAScript supports. These keywords indicate beginnings and/or endings of ECMAScript statements. By rule, keywords are reserved and cannot be used as variable or function names. Here is the complete list of ECMAScript keywords:

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

You can easily edit JavaScript by JavaScript editor. If you use a keyword as a variable or function name, you will probably be greeted with an error message like this:

"Identifier expected."

ECMAScript also defines a number of reserved words. The reserved words are, in a sense, words that are reserved for future use as keywords. Because of this, reserved words cannot be used as variable or function names. The complete list of reserved words in ECMA-262 Edition 3 is as follows:

 abstract enum       int       short
 boolean  export     interface static
 byte     extends    long      super
 char     final      native    synchronized
 class    float      package   throws
 const    goto       private   transient
 debugger implements protected volatile
 double   import     public

If you use a reserved word as a variable or function name, more than likely you will not receive an error...until a future browser implements one of them. Then the word will be considered a keyword, and you will get a keyword error.

Retrieved from ""

Last modified: Tue, 09 Oct 2007 02:13:00 +0000 Hits: 1,552