Chapter 4. Objects
- How to create and use objects
- What are the constructor functions
From Arrays to Objects
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"]
If you put the indexes in one column and the values in another, you'll end up with a table of key/value pairs ...