Changes

Jump to: navigation, search

JavaScript Arrays

10 bytes added, 14:07, 15 May 2007
What is an Array
In [[Introducing JavaScript Variables]] and [[JavaScript Variable Types]] we looked at storing data (such as numbers, strings and boolean true or false values) in memory locations known as variables. The variable types covered in those chapters were useful for storing one value per variable. Often, however, it is necessary to group together multiple variables into a self contained object. This is where the concept of JavaScript Arrays comes in.
== What is an a JavaScript Array ==
A JavaScript array is an object that contains a number items. Those items can be variables (such as strings or numbers) or even other objects (such as Image objects or custom objects which you as a JavaScript developer have created). Once you have grouped all the items into the array you can then perfrom tasks like sorting the array items into alphabetical order, accessing and changing the value assigned to each array item and passing the group of items as an argument to a JavaScript function (see [[Understanding JavaScript Functions]]) by passing just the array object.

Navigation menu