O'Reilly logo

JavaScript® 24-Hour Trainer by Jeremy McPeak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Objects and Built-In Types

You live in an object-based world. Stop and think about the objects you come in contact with pretty much every second of every day. Whether you're driving to work or school, sitting at a table eating dinner, sleeping in a bed, or even walking in a field — you're interacting with objects. You don't even think about most of the objects you come in contact with every day. Interaction with objects is natural to you.

Before the 1990s, programmers primarily used procedural programming languages. These languages were based on the steps a program takes to reach the desired goal — very much like the examples thus far in this book. It wasn't until the 1990s that mainstream developers began to shift their thinking to involve objects.

Objects are a very important part of JavaScript: In fact, just about everything in JavaScript is an object. An understanding of what objects are and how to use them is required in order to use the language to its full potential. First let's talk a little more about what objects are and why they're useful.

WHAT ARE OBJECTS?

It's easiest to understand objects in a programming context by comparing them with real-world examples. Consider an automobile as an example. Automobiles come in a variety of colors, and are made by manufacturers that build them into different models. Some have vinyl interiors, while others have leather. Most automobiles come with an automatic transmission, and a small number of them have manual transmissions. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required