1, the object copy Pit Object.assign ()
Object.assign () // shallow copy basic useless with direct = same as object.assign (true// Think is a deep copy, in fact, is only a level of attribute replication, more than a shallow copy of a layer of deep copy. The second layer is a shallow copy, which changes the original value
2, the array copy of the pit, even if the slice copy, if the internal is an object, or will address point, resulting in the modification of the new array, the old array also changed
var arr = [{a:11},{a:11}]; // arr [{a:11},{a:11}] var arr1 = arr.slice (0); // arr1 [{a:11},{a:11}]arr1[0].a = +////arr1 [{a:22},{a:11}] arr [{a:22},{a:11}]
As it turns out, slice replication is just a sneak copy, and cannot be deeply copied object content
3, also is the array copy pit, if the array content element is the object, the map will also change the original value
var // arr [{a:11},{a:11}] Arr.map (v=>{v.b=22; return// are you too naïve to think this arr has no half-dime relationship, ARR has changed //arr [{A : 11,b:22},{a:11,b:22}] has come up with a B-property ....
"Deep Copy Pit" 1, object assign copy of False depth, 2, array slice copy pits, 3, and array map copy pits