虽然深克隆有简单粗暴的一句话方式
let newArr2 = JSON.parse(JSON.stringify(arr));
但是会带来爆栈的危险
// Maximum call stack size exceeded
所以有大佬想出来了栈方式
function cloneForce(x) {
// 用来去重
const uniqueList = [];
let root = {
};
// 循环数组
const loopList = [
{
parent: root