Array.clone Function
Creates a shallow copy of an Array object. This function is static and can be invoked without creating an instance of the object.
var cloneVar = Array.clone(array);
Use the clone function to create a shallow copy of an Array object. A shallow copy contains only the elements of the array, whether they are reference types or value types. However, it does not contain the referenced objects. The references in the new Array object point to the same objects as in the original Array object. In contrast, a deep copy of an Array object copies the elements and everything directly or indirectly referenced by the elements.
Note
|
|---|
|
In Mozilla Firefox version 2.0.0.1 and earlier, the Array.addRange and Array.clone functions might drop elements from the ends of large, sparse arrays. |
Note