function copy(obj) {
let res = obj instanceof Array ? [] : {};
for (const [k, v] of Object.entries(obj)) {
res[k] = typeof v == 'object' ? copy(v) : v;
}
return res;
}
09-19
159
05-24
627