11.12.2012 Views

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Generally speaking, reserved words are reserved from use because they already have a<br />

defined meaning in some variant of <strong>JavaScript</strong> or a related technology. Reserved words<br />

generally are categorized in three types:<br />

Language keywords<br />

Future reserved words<br />

Words such as object names or related technology keywords<br />

Table C-1 lists the words in the first two categories based upon the <strong>JavaScript</strong> 1.5 specification<br />

combined with Microsoft‘s Jscript documentation.<br />

Table C-1: Reserved Words in <strong>JavaScript</strong> 1.5<br />

>abstract else instanceof switch<br />

>boolean enum int synchronized<br />

>break export interface this<br />

byte extends long throw<br />

case false native throws<br />

catch final new transient<br />

char finally null true<br />

class float package try<br />

const for private typeof<br />

continue function protected val<br />

debugger goto public var<br />

default if return void<br />

delete implements short volatile<br />

do import static while<br />

double in super with<br />

Note Some reserved words related to types not found in <strong>JavaScript</strong>, like byte, are reserved in<br />

some versions of ECMAScript and not others.<br />

Beyond these well-known reserved words, there are other words that may have problems under<br />

some versions of <strong>JavaScript</strong> including ECMAScript 4, Jscript.NET, and <strong>JavaScript</strong> <strong>2.0</strong>. While<br />

the words shown in Table C-2 may not actually be reserved in your browser, they should be<br />

avoided just to be safe.<br />

Table C-2: Potentially Reserved Words<br />

As event Is uint<br />

Assert get Namespace ulong<br />

Decimal include Require use<br />

Ensure internal Sbyte ushort<br />

Exclude invariant Set<br />

<strong>The</strong> third category of dangerous identifiers includes names of intrinsic <strong>JavaScript</strong> objects,<br />

functions, and data types. Words like String, parseInt, document, and so on, are included in<br />

this category. <strong>The</strong>re are far too many of these ―dangerous‖ identifier names to list, but consider<br />

anything in Appendix A or Appendix B to be a <strong>JavaScript</strong> identifier and inappropriate for other<br />

use.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!