ChunkySoup.net Serving hearty nuggets since 2001

Intro to Object Oriented JavaScript

Part 2: Existing Objects and the DOM

Besides basic data types like integers and strings, most object based languages (Java, C++, ECMAScript derivatives) have a set of predefined objects that are native to the environment. If you are coming to JavaScript from a Flash ActionScript background you will be familiar with Movie Objects and Button Objects.

JavaScript has two types of objects you should be familiar with already. Data objects like integers, strings, arrays and images and the document object model (DOM) and related data (or node) types. Different browsers have used different DOMs in the past, but it looks like vendors are finally converging on the standard W3C DOM. If you're not yet intimately familiar with the W3C DOM I suggest taking a bit of time to become so. Here is one visual representation of the W3C DOM brought to you courtesy of the Mozilla DOM Viewer and the home page of this site.

screenshot of Mozilla DOM Viewer

In my opinion knowing the W3C DOM (and the various other DOMs) is much more important to a JavaScript developer then object oriented methodology is. If the above illustration confuses you I suggest tackling the DOM and DOM Nodes now, and then coming back to this article some other time.