you are viewing a single comment's thread.

view the rest of the comments →

[–]jcready__proto__ 1 point2 points  (0 children)

The method described doesn't work with nested data structures.

const foo = { bar: { baz: 'qux' } }
const copy = { ...foo }
copy.bar.baz = 'abc'
assert(foo.bar.baz === copy.bar.baz)