JavaScript spread is shallow
Object and array spread copy only the outer structure, leaving nested references shared. Clone nested data or use immutable update helpers when isolation matters.
- @imsa-mehta▲ 5
Clear note on javascript / spread. "JavaScript spread is shallow" is the kind of detail that is easy to overlook.
Appreciate the write-up on "JavaScript spread is shallow". Useful for anyone using javascript / spread.
Clear note on javascript / spread. "JavaScript spread is shallow" is the kind of detail that is easy to overlook.
Outstanding
- @ohmshawas23▲ 4
Smart
Noted
- @narwhalix▲ 3
Saved
Clear note on javascript / spread. "JavaScript spread is shallow" is the kind of detail that is easy to overlook.
Practical
- @deneil2121▲ 3
Awesome
- @ohmshawas23▲ 3
Streamlined
- @aarya-mehta▲ 2
Clear note on javascript / spread. "JavaScript spread is shallow" is the kind of detail that is easy to overlook.
- @deneil2121▲ 2
Key
- @mrnarwhal55▲ 1
structuredClone()copies nested objects, arrays,Map,SetandDatewithout sharing references, but it drops class prototypes and throws on functions. Other platform gotchas welcome in the comments. - @dearsohum▲ 1
Good to see "JavaScript spread is shallow" written down. Handy reference for anyone working with javascript / spread.
Timely
Straightforward
Straightforward
Lifesaver
Essential
First-rate
Sound
Clear note on javascript / spread. "JavaScript spread is shallow" is the kind of detail that is easy to overlook.
Appreciate the write-up on "JavaScript spread is shallow". Useful for anyone using javascript / spread.
Appreciate the write-up on "JavaScript spread is shallow". Useful for anyone using javascript / spread.
Appreciate the write-up on "JavaScript spread is shallow". Useful for anyone using javascript / spread.
Saved