Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 17x 11x 6x 8x 3x 3x 5x 5x 3x | export function deepClone(obj) {
if (obj === null || typeof obj!== 'object') {
return obj;
}
if (Array.isArray(obj)) {
return obj.map(item => deepClone(item));
}
const clonedObj = {};
for (const key in obj) {
Eif (obj.hasOwnProperty(key)) {
clonedObj[key] = deepClone(obj[key]);
}
}
return clonedObj;
} |