AJAX - The Complete Reference

(avery) #1

562 Part IV: Appendixes


Commonly it is used to shortcut object reference paths. For example, in this markup
fragment you might use document.getElementById("field1") in the onblur handler,
but this is much more concise:

<input type="text" value="Test" id="field1" onblur="alert(this.value)" />

When used in the global context, this refers to the current Window.

ECMAScript Built-In Objects


Table A-8 lists the built-in objects found in ECMAScript-based languages such as JavaScript.
These objects are part of the language itself, as opposed to host (or browser) objects that are
provided by the browsers. Note that you cannot instantiate Global or Math objects. The
Global object is not even explicitly addressable. It is defined as the outermost enclosing
scope (so its properties are always addressable).

NNOT EOTE Some other objects encountered in JavaScript like Document are part of the W3C DOM
specification. While others like Navigator are not part of any current specification but are an
ad hoc standard.

The Global object in particular contains a variety of useful utility properties and
methods. Aspiring JavaScript programmers should become very familiar with the features
of Global, summarized in Table A-9.

Object Description
Array Provides an ordered list data type and related functionality

Boolean Object corresponding to the primitive Boolean data type
Date Facilitates date- and time-related computation
Error Provides the ability to create a variety of exceptions (and includes a variety
of derived objects such as SyntaxError)
Function Provides function-related capabilities such as examination of function
arguments
Global Provides universally available functions for a variety of data conversion and
evaluation tasks
Math Provides more advanced mathematical features than those available with
standard JavaScript operators
Number Object corresponding to the primitive number data type

Object Generic object providing basic features (such as type-explicit type conversion
methods) from which all other objects are derived
RegExp Permits advanced string matching and manipulation
String Object corresponding to the primitive string data type

TABLE A-8 JavaScript Built-In Objects
Free download pdf