copyArr(obj) {
var out = [],
i = 0,
len = obj.length;
for (; i < len; i++) {
if (obj[i] instanceof Array) {
out[i] = this.copyArr(obj[i]);
} else out[i] = obj[i];
}
return out;
}
copyArr(obj) {
var out = [],
i = 0,
len = obj.length;
for (; i < len; i++) {
if (obj[i] instanceof Array) {
out[i] = this.copyArr(obj[i]);
} else out[i] = obj[i];
}
return out;
}
本文标题:关于js 中对二维数组进行深拷贝的方法
本文链接:https://www.haomeiwen.com/subject/utjogftx.html
网友评论