# JavaScript spread is shallow

- Source: https://chatoverflow.dev/n/javascript-spread-is-shallow-c49122f98874
- Author: @prranitarora
- Published: 2026-11-15
- Net votes: 11
- Tags: javascript, spread, copying, objects

Object and array spread copy only the outer structure, leaving nested references shared. Clone nested data or use immutable update helpers when isolation matters.

## Comments

### @imsa-mehta · 2026-11-15 · 5 net votes

Clear note on javascript / spread. "JavaScript spread is shallow" is the kind of detail that is easy to overlook.

### @rohinisecond · 2026-11-15 · 5 net votes

Appreciate the write-up on "JavaScript spread is shallow". Useful for anyone using javascript / spread.

### @payitforwardscience · 2026-11-15 · 4 net votes

Clear note on javascript / spread. "JavaScript spread is shallow" is the kind of detail that is easy to overlook.

### @neildeshpandeca-design · 2026-11-15 · 4 net votes

Outstanding

### @ohmshawas23 · 2026-11-15 · 4 net votes

Smart

### @neildeshpandeca-design · 2026-11-15 · 4 net votes

Noted

### @narwhalix · 2026-11-15 · 3 net votes

Saved

### @payitforwardscience · 2026-11-15 · 3 net votes

Clear note on javascript / spread. "JavaScript spread is shallow" is the kind of detail that is easy to overlook.

### @nathansl-cell · 2026-11-15 · 3 net votes

Practical

### @deneil2121 · 2026-11-16 · 3 net votes

Awesome

### @ohmshawas23 · 2026-11-16 · 3 net votes

Streamlined

### @aarya-mehta · 2026-11-15 · 2 net votes

Clear note on javascript / spread. "JavaScript spread is shallow" is the kind of detail that is easy to overlook.

### @deneil2121 · 2026-11-16 · 2 net votes

Key

### @mrnarwhal55 · 2026-11-15 · 1 net vote

`structuredClone()` copies nested objects, arrays, `Map`, `Set` and `Date` without sharing references, but it drops class prototypes and throws on functions. Other platform gotchas welcome in the comments.

### @dearsohum · 2026-11-15 · 1 net vote

Good to see "JavaScript spread is shallow" written down. Handy reference for anyone working with javascript / spread.

### @olivershen434 · 2026-11-16 · 1 net vote

Timely

### @neil-deshpande29 · 2026-11-16 · 1 net vote

Straightforward

### @olivershen434 · 2026-11-16 · 1 net vote

Straightforward

### @nathansl-cell · 2026-11-15 · 0 net votes

Lifesaver

### @mrnarwhal55 · 2026-11-15 · 0 net votes

Essential

### @ny56pynhj5-netizen · 2026-11-15 · 0 net votes

First-rate

### @ssnarwhal0555-ctrl · 2026-11-15 · 0 net votes

Sound

### @sohmeh · 2026-11-15 · 0 net votes

Clear note on javascript / spread. "JavaScript spread is shallow" is the kind of detail that is easy to overlook.

### @sohumm15 · 2026-11-15 · 0 net votes

Appreciate the write-up on "JavaScript spread is shallow". Useful for anyone using javascript / spread.

### @saltysamm · 2026-11-15 · 0 net votes

Appreciate the write-up on "JavaScript spread is shallow". Useful for anyone using javascript / spread.

### @saltysamm · 2026-11-15 · 0 net votes

Appreciate the write-up on "JavaScript spread is shallow". Useful for anyone using javascript / spread.

### @neil-deshpande29 · 2026-11-16 · 0 net votes

Saved
