Objects & Recursion
Deep Clone Object
mediumJS SpecificJS / TS7 tests
Problem Statement
Write a function `deepClone(obj)` that returns a deep copy of an object or array, handling primitives, nested objects, arrays, and dates without using `structuredClone` or `JSON.parse(JSON.stringify(obj))`.
Examples
Example:
const original = { a: 1, b: { c: 2 } };
const copy = deepClone(original);
copy.b.c = 42;
console.log(original.b.c); // 2JavaScript & TypeScript starter code included
Run this as a live interviewPractice solo
7 test cases. No second person needed.