| ★ wanayoo — archive 1999 http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array/push | Nouvelle recherche | Portail wanayoo |
Mutates an array by appending the given elements and returning the new length of the array.
| Method of Array | |
| Implemented in: | JavaScript 1.2, NES 3.0
JavaScript 1.3: |
| ECMA Version: | ECMA-262 Edition 3 |
The push method is useful for easily appending values to an array. The return value of this method is the new length property of the object upon which the method was called.
push is intentionally generic. This method can be called or applied to objects resembling arrays. The push method relies on a length property to determine where to start inserting the given values. If the length property cannot be converted into a number, the index used is 0. This includes the possibility of length being nonexistent, in which case length will also be created.
The only native, array-like objects are strings, although they are not suitable in applications of this method, as strings are immutable.
Page last modified 05:55, 18 Jul 2008 by Sevenspade