Lessons learnt About Javascript object cloning:- Angular 2 Training in Mumbai Andheri.

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



This entry was posted in Angular 2 training, Angular Mumbai Training, ASP.NET MVC Training, Class Room Training, MVC, MVC Training in Mumbai and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *