Appframe Knowledge Base

1 hits

How to recursively clone an array in JavaScript

// Used for making a copy/clone of an existing array
var firstArray = ["A", "B", "C"],
	newArray = af.common.copyArray(firstArray);
// newArray will now be a clone of firstArray
// The function clones recursively, so be careful to
// not pass in arrays that have a reference to them selves.

common web · Perma link post comment Posted by: Øystein Kaldestad (12-apr-2013)