HTML and CSS Reference
Figure 9.12 An associative array—one key associated with more than one value.
to manipulate it. The length property of an array was used in previous examples to deter-
mine the size of an array. Now we will look at methods that allow you to manipulate
arrays such as adding a new element at the beginning or end of an array, removing an
whole set of methods for doing all of these things and more (see Table 9.2).
Table 9.2 Array Methods
What It Does
Concatenates elements from one array to another array.
Joins the elements of an array by a separator to form a string.
Removes and returns the last element of an array.
Adds elements to the end of an array.
Reverses the order of the elements in an array.
Removes and returns the first element of an array.
Creates a new array from elements of an existing array.
Sorts an array alphabetically or numerically.
Removes and/or replaces elements of an array.
Returns a string representation of the array in local format.
Returns a string representation of the array.
Adds elements to the beginning of an array.