JavaScript Objects

The simplest objects that can be referenced and controlled via JavaScript are JavaScript's built-in objects. Strictly speaking, these objects are not part of the Document Object Model; instead, they are part of JavaScript itself. However, their properties and methods are used in the same manner. JavaScript includes a number of its own objects—three of the most useful are the Date, Math, and RegExp objects.

JavaScript objects, because they are outside the Web Browser Object Model hierarchy, are not the properties of any other object. In other words, to reference a JavaScript object, you need to use the object name itself instead of prefacing it with window or document, as shown in the next three sections.

Using the Date Object ...

Get Platinum Edition Using XHTML™, XML, and Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.