浅拷贝Object.assign()
时间: 2023-10-12 20:04:06 浏览: 92
JavaScript 复制对象与Object.assign方法无法实现深复制
5星 · 资源好评率100%
浅拷贝是指通过Object.assign()方法创建的新对象与原对象共用同一块内存地址,因此当原对象的属性值发生改变时,新对象的对应属性值也会受到影响。这种情况适用于属性值为简单类型(如字符串、数字)的情况。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [ES6之Object.assign()用法,Object.assign()到底是浅拷贝还是深拷贝?](https://blog.csdn.net/ZiChen_Jiang/article/details/121858927)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
阅读全文