浅拷贝(shallow copy):只复制指向某个对象的指针,而不复制对象本身,新旧对象共享一块内存;
深拷贝(deep copy):复制并创建一个一摸一样的对象,不共享内存,修改新对象,旧对象保持不变;实现深拷贝主要有2种方法
(1)递归 (2)JSON.stringify结合JSON.parse
(1)递归
(2)JSON.stringify结合JSON.parse