JS 深度复制数组
/** * 深度复制数组 * @param data * @returns {{}} */ function deepClone(data) { let d; if (typeof data === "object") { if (data == null) { d = null; } else { if (data.constructor === Array) { d = []; for (let i in data) { d.push(deepClone(data[i])); } } else { d = {}; for (let i in data) { d[i] = deepClone(data[i]); } } } } else { d = data; } return d; }

浙公网安备 33010602011771号