In this chapter, we'll be looking at a concept that is central to JavaScript, namely objects. But what are objects, and why are they useful?
First, I have to make a confession: You have been using objects throughout this book. For example, an Array is an object. I just kept it quiet for simplicity, but now you're ready to learn the "horrible" truth. JavaScript is an object-based language, and therefore much of what we do involves manipulating objects. We'll see that by making full use of these objects, the range of things we can do with JavaScript expands immensely.
We'll start this chapter by introducing the idea of what objects are and why they are important. We'll move on to see what kinds of objects we use in JavaScript, how to create them and use them, and how they simplify many programming tasks for us. Finally, we'll look in more detail at some of the most useful objects that JavaScript provides for us and see how to use these in practical situations.
Not only does JavaScript itself consist of a number of these things called objects (which we term native JavaScript objects), but also the browser itself is modeled as a collection of objects available for our use. We'll learn about these objects in particular in the next chapter.