Friday, April 14, 2017

shallow and deep copies in JavaScript

Appending to this, you may swallow copy stuff with myArray.slice(0) or just myArray.slice() while a deep copy looks more like this:

var foo = JSON.parse(JSON.stringify(bar));

 
 

This trick in C# is more or less the same hack.

No comments:

Post a Comment