11.13 Arrays

Overview

Normal objects have different names for each of the object’s different data items. For example, a dog object has name, sound, and trick properties for its different data items. Now we’ll look at a special type of object that holds multiple data items and uses a common name for all of them. That special type of object is an array.

In the past, we’ve used the term collection to describe a group of items with a common name. An array is not only a special type of object; it’s also a special type of collection. Remember in the last chapter how we retrieved a collection of t-shirt color radio buttons using the following code?

tshirtRBs = form.elements["color"];

And then later, we used the tshirtRBs name to access individual ...

Get Web Programming with HTML5, CSS, and JavaScript 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.