July 2008
Beginner
356 pages
6h 8m
English
Now that you've mastered JavaScript's primitive data types, arrays, and functions, it is time for the best part—objects. In this chapter, you will learn:
As you already know from Chapter 2, an array is just a list of values. Each value has an index (a numeric key) starting from zero and incrementing by one for each value.
>>>> var myarr = ['red', 'blue', 'yellow', 'purple']; >>> myarr;
["red", "blue", "yellow", "purple"]
>>> myarr[0]
"red"
>>> myarr[3]
"purple"
If you put the indexes in one column and the values in another, you'll end up with a table of key/value pairs ...
Read now
Unlock full access