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

Chapter 10. Arrays > Adding Elements to Arrays

Adding Elements to Arrays

So far we have created an array and placed elements in the array; now lets add elements to an array. There are a couple ways of accomplishing this. Let's start with the simple methods and move into the more dynamic methods.

You can start by setting the length property of an array. Setting the length property of an array will add as many blank elements to that array as you specify—but again, the last blank element will have the index of the length minus 1. Here's an example:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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