原因:JavaScript 中对象的赋值是默认引用赋值的(两个对象指向相同的内存地址)
解决方案:
let obj1 = {‘name‘: ‘hello world‘}; let obj2 = Object.assign({},obj1);
原文地址:https://www.cnblogs.com/Blogzlj/p/12109882.html
时间: 2024-11-05 12:35:23
let obj1 = {‘name‘: ‘hello world‘}; let obj2 = Object.assign({},obj1);
原文地址:https://www.cnblogs.com/Blogzlj/p/12109882.html