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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Part VII: Appendixes<br />

Appendix A: Core Syntax Quick <strong>Reference</strong><br />

Appendix B: <strong>JavaScript</strong> Object <strong>Reference</strong><br />

Appendix C: <strong>JavaScript</strong> Reserved Words<br />

Appendix A: Core Syntax Quick <strong>Reference</strong><br />

<strong>The</strong> syntax of core language features is covered in this section. <strong>The</strong> data here is intended for<br />

use as a quick reference and examples will be kept to a minimum. For a more complete<br />

discussion of each item, see the appropriate chapter of the book. Our conventions will be<br />

Italicized text to indicate a key term or phrase, and also to indicate a placeholder for<br />

some specified grammatical or lexical unit, such as an expression, statement, or<br />

sequence of characters.<br />

Boldfaced text to indicate language keywords or reserved words.<br />

[Bracketed text] to indicate optional grammatical units. Note that [unit1] [unit2] permits<br />

the absence of unit1 and unit2; or unit1 followed by unit2; or unit1; or unit2; while [unit1<br />

[unit2]] permits the absence of unit1 and unit2; or unit1; or unit1 followed by unit2. <strong>The</strong><br />

only exception is in the discussion of arrays and objects, which necessitate ―real‖<br />

brackets.<br />

An ellipsis (...) to indicate repetition of the previous unit in the natural way.<br />

to indicate a generic operator.<br />

You can find the full specification for ECMAScript, which is the core of <strong>JavaScript</strong>, at<br />

www.ecma.ch, currently at http://www.ecmainternational.org/publications/standards/Ecma-262.htm.<br />

Note, however, that there may be<br />

some slight aspects to the language discussed in this appendix that are part of the ad hoc<br />

standard implemented by browser vendors and not found in the ECMA specification.<br />

Language Fundamentals<br />

<strong>The</strong> following points are core principles of <strong>JavaScript</strong>:<br />

Excess white space is ignored when outside of a regular expression literal or string.<br />

Statements are terminated with a semicolon.<br />

Semicolons are automatically inserted on lines with complete statements. (Returns<br />

imply semicolons for complete statements.)<br />

Data is weakly typed.<br />

<strong>Reference</strong>s to identifiers are resolved using lexical (static) scoping. <strong>The</strong> one exception<br />

to this is class properties of the RegExp object, which are dynamically scoped.<br />

Indices are enumerated beginning with zero.<br />

<strong>The</strong>re are four kinds of available objects: built-in objects, host (browser) objects,<br />

document objects and user-defined objects.<br />

It is a prototype-based object oriented language (not class-based in its current<br />

incarnation).<br />

Source code is interpreted.<br />

Comments use C++ inline comment style // or C-style block comment /* */.<br />

I/O is limited in most cases to interaction with Web documents and the user (no local<br />

filesystem or network access by default).<br />

Language Versions<br />

<strong>The</strong> versions of the various core languages and their relationships are listed in Tables A-1<br />

through A-6.<br />

Table A-1: Standard Versions of <strong>JavaScript</strong>

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

Saved successfully!

Ooh no, something went wrong!