js copy model with only one change code example
Example 1: move items from one log to another typescript
var array1 = [1, 2, 3, 4, 5];
var array2 = [];
for(var i = 0; i < array1.length; i++) {
array2.push(array1[i]);
array1.splice(i, 1);
i--; //decrement i IF we remove an item
}
console.log(array1); //[]
console.log(array2); //[1, 2, 3, 4, 5]
Example 2: set variable to object without editing old object js
var newObject = jQuery.extend(true, {}, myObj);
//requires jquery