In one of recent Angular 2 training we had a situation where we need to clone (create fresh copy) of Javascript single object and Array of objects. Below are simple codes for the same
Cloning single Javascript object varnewobject = Object.assign({}, oldobject);;
For cloning collection.
cloning copy of a javascript array
var array2 = array1.slice();
If you wish to do deep copy serialize and deserialize with JSON.
Do not miss our next Angular 2 batch coming week in Mumbai
http://stepbystepschools.net/?page_id=622