#10 most askedVery commonMediumReferences & copying
Implement deepClone
🏢 Asked in real interviews
No reports yet. Were you asked this? Be the first to say where.Write deepClone(value) that copies nested objects and arrays, so changing the copy never affects the original. Plain objects, arrays and primitives are enough.
🧪 Practice
Write your solution, then press Run tests. Explain your approach out loud as you go.
function deepClone(value) {
// your code here
}
Output appears here. Press Run or Ctrl/⌘ + Enter.
Try it first. Struggling for a few minutes is how it sticks.