Chapter 5. A trip to Objectville
Understanding Objects
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! We 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 to 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 do in the next chapter), to organizing your data, and theyâre even the fundamental way many JavaScript libraries are packaged up (more on that much later in the book). That said, objects are a difficult topic, right? Hah! Weâre going ...
Get Head First JavaScript Programming 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.