深拷贝的实现
function deepCopy(data) {
let obj;
if (Array.isArray(data)) {
obj = [];
for (let i = 0 ; i < data.length ; i ++) {
obj.push(deepCopy(data[i]));
}
} else if (typeof data == "object") {
obj = {};
for (let keys in data) {
obj[keys] = deepCopy(data[keys]);
}
} else {
obj = data;
}
return obj;
}