August 1999
Intermediate to advanced
1488 pages
72h 53m
English
array.unshift(arg1,…argN)
The unshift() method adds the arguments listed in the parameter list to the front of the array as new elements. Existing elements are shifted up to allow room for the new elements. Table 6.18 lists the arguments and return values associated with this method.
| Type | Item | Description |
|---|---|---|
| Arguments | arg1,…argN | Elements to be added to the array |
| Returns | The length of the array after adding the new elements. |
Listing 6.61 creates an array of school grades. Two new grades, 100 and 93 are added to the front of the array using the unshift() method. After the unshift() method has executed, ...
Read now
Unlock full access