Java Reference
In-Depth Information
JavaScript—An Object‐Based
Language
What You Will learn in this Chapter:
Using JavaScript's built‐in objects to work with complex data
Creating custom objects to represent complex ideas and data
Defining custom reference types
Wrox.Com Code doWnloads for this Chapter
You can find the wrox.com code downloads for this chapter at http://www.wiley.com/go/
BeginningJavaScript5E on the Download Code tab. You can also view all of the examples
and related files at http://beginningjs.com .
In this chapter, you look at a concept that is central to JavaScript, namely objects . But what
are objects, and why are they useful?
First, we have to break it to you: You have been using objects throughout this topic (for
example, an array is an object). JavaScript is an object‐based language, and therefore most of
what you do involves manipulating objects. You'll see that when you make full use of these
objects, the range of things you can do with JavaScript expands immensely.
We'll start this chapter by taking a look at the idea of what objects are and why they are
important. We'll move on to what kinds of objects are used in JavaScript, how to create them
and use them, and how they simplify many programming tasks for you. Finally, you'll see in
more detail some of the most useful objects that JavaScript provides and how to use these in
practical situations.
Not only does the JavaScript language consist of a number of these things called objects (which
are also called native JavaScript objects ), but also the browser itself is modeled as a collection
of objects available for your use. You learn about these objects in particular in Chapter 8.
 
Search WWH ::




Custom Search