• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 11. Arrays > Arrays as Objects

11.10. Arrays as Objects

Once you've read Chapter 12, you should recognize that arrays are a type of object, specifically, instances of the Array class. As with other objects, Array objects can have properties added to them. When we add named elements to an array, we're really just adding properties to an Array object. However, as we saw earlier, to use the built-in methods of the Array class we must work with numbered elements.

In Chapter 9, we saw a useful "array-object" hybrid, the arguments object, that combined numbered elements with properties. (Recall that the arguments object has callee and caller properties but also stores an array of parameters as array elements.) Now we can see that all arrays contain their numbered list of elements, plus the built-in property length, plus any custom properties we add.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint