数组的浅拷贝 Array.slice() let arr1 = [1, 2, { a: 3 }] let arr2 = arr1.slice() arr2[2].a = 4 console.log(arr1) // [ 1, 2, { a: 4 } ] console.log(arr2) // [ 1, 2, { a:……
来自分类:前端
数组的浅拷贝 Array.slice() let arr1 = [1, 2, { a: 3 }] let arr2 = arr1.slice() arr2[2].a = 4 console.log(arr1) // [ 1, 2, { a: 4 } ] console.log(arr2) // [ 1, 2, { a:……
版权所有 © 2022 cinob的博客 | 辽ICP备17021658号-2
Theme Memory By Shawn With | All Rights Reserved
(●'◡'●)ノ本博客已萌萌哒运行了