Chapter 5. Understanding Objects: A trip to Objectville
So far, you’ve been using primitives and arrays in your code. And you’ve approached coding in quite a procedural manner, using simple statements, conditionals, and for/while loops with functions—that’s not exactly object-oriented. In fact, it’s not object-oriented at all! You did use a few objects here and there without really knowing it, but you haven’t written any of your own objects yet. Well, the time has come to leave this boring procedural town behind and create some objects of your own. In this chapter, you’re going to find out why using objects is going to make your life so much better—well, better in a programming sense (we can’t really help you with your fashion sense and your JavaScript skills all in one book). Just a warning: once you’ve discovered objects, you’ll never want to come back. Send us a postcard when you get there.
Did someone say “objects”?!
Ah, our favorite topic! Objects are going to take your JavaScript programming skills to the next level—they’re the key to managing complex code, to understanding the browser’s document model (which we’ll get to in the next chapter), to organizing your data...and they’re even the fundamental way many JavaScript libraries are packaged up. So objects must be a difficult topic, right? Hah! We’re going to jump in head first, and you’ll be using them in no time. ...
Get Head First JavaScript Programming, 2nd Edition 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.