对象数组的解构赋值是浅拷贝

var a = [{id: 1},{id: 2}];var b = [...a];b[0].id = -1;console.log(a,b)
posted @ 2022-09-21 09:08  古德拉克  阅读(18)  评论(0编辑  收藏  举报