clone

.clone()

Returns a copy of this array.

This is a 'shallow' copy of the array. That means that the elements are not individually cloned, and instead they are now present in both the original and new array.

ns = [ 1, 2, 3 ]
ns2 = ns.clone()

ns2[0] = 400

console( ns ) // prints [ 1, 2, 3 ]
console( ns2 ) // prints [ 400, 2, 3 ]