Deep copy data

Deep copy data in JavaScript — with the four heights of help laid out: do it now, make it easier for the next person to accept, work out the right move when you are stuck, and learn the pattern so it stops coming back.

4prompt heights
Open it in the interactive atlas →

The four heights

The same task, four distances: today's deadline, the next reviewer, the stuck moment, the pattern.

Execute — do the immediate task

+
I need a reliable deep copy of this userSettings object before I modify it. Copy every nested…
I need a reliable deep copy of this userSettings object before I modify it. Copy every nested object and array so mutating the copy won’t touch the original. Keep functions, Dates and RegExp intact and preserve prototype links where possible. I will then run transformations for display. Make the copy here and confirm its top-level keys match the original.

Improve — make it easier to accept

+
Before I wire this into the form code, make the deep copy easier to validate: show the total number…
Before I wire this into the form code, make the deep copy easier to validate: show the total number of nested keys, surface any properties that are functions, Dates or RegExp at the top, and flag fields that look like DOM nodes or circular references that would break serialization.

Decide — diagnose the stuck moment

+
I just copied sessionState, applied changes in the UI, and found the original mutated. sessionState…

I cloned the object, then the UI started mutating the original.

I just copied sessionState, applied changes in the UI, and found the original mutated. sessionState is used by other modules and I can’t tell where a reference leaked. I’m afraid my copy logic missed nested arrays or prototype-linked objects. I don’t know whether the leak came from a function property or a Date. What likely went wrong and what exact check-and-fix should I run now to prevent mutation escape?

Become — change the pattern

+
Across projects I keep introducing bugs from shallow copies: form edits overwrite shared state and…

Repeated bugs from shallow clones

Across projects I keep introducing bugs from shallow copies: form edits overwrite shared state and tests flake. I spend time tracking down which module mutated the shared object. Which habit should I change in my workflow to stop this recurring pain, and what small checklist or helper function would save the most time on future copies?

Next to this one

Other programming language work people do in JavaScript.

Every task here came from the work, not from a feature list — which is why the prompts name what you want done and never the button that does it. The tool changes; the work does not.
Copyright © LLOS.ai · 2026 — original pedagogy, voice, and design — all rights reserved.

The rest of the map

Same library, five ways in.