Here is how I did it:
var newArray = JSON.parse(JSON.stringify(orgArray));
this will create a new deep copy that is not associated with the first (not a shallow copy).
also this, obviously, will not clone events and functions, but itβs good that you can do it in one line and it can be used for any object king (arrays, strings, numbers, objects ...)
Chtiwi Malek Apr 23 '14 at 13:33 2014-04-23 13:33
source share