DEV Community

Cover image for Bye-Bye `JSON.stringify()` and `{...obj}`, Hello `structuredClone()`!

Bye-Bye `JSON.stringify()` and `{...obj}`, Hello `structuredClone()`!

Dharmendra Kumar on September 04, 2024

What is structuredClone()? structuredClone() is a global function introduced in 2022 that enables deep cloning of JavaScript objects. Unlike t...
Collapse
 
alexus85 profile image
Alex Petrik

Finally something new, that hasn't been already mentioned all over the internets . Thanks! :)

Collapse
 
bernardoow profile image
Bernardo Gomes

Thanks for sharing

Collapse
 
silvermock profile image
Marco Silvestroni

Good to know!

Collapse
 
msegmx profile image
msegmx

AI much? You didn't even care to run and print the results of 4) 🙄

Collapse
 
syedmuhammadaliraza profile image
Syed Muhammad Ali Raza

👍

Collapse
 
mark_bulusi profile image
Mark Bosco

tks for the post

Collapse
 
jthomp profile image
jthomp

Neat! Thanks for the writeup!

Collapse
 
plto001 profile image
Gyuhang Shim

Good article. Thanks, I got a new good knowledge. :)

Collapse
 
85_lokeshdubey_3c9994433 profile image
85 Lokesh Dubey

Thanks for the article.

Collapse
 
arvindsuriyaa profile image
arvindsuriyaa

Good read !

Collapse
 
danshari profile image
Zach Koch

Console output is missing from section 4

Collapse
 
varuntatva profile image
Varun-Tatva

Very informative.
If we want a shallow copy of a object with having function then {...object} is the way but is there any way to deeply clone a object with having functions?.

Collapse
 
cauuesanttos profile image
Cauê Santos

Thanks for the article

Collapse
 
hufeicom profile image
hufei

Circular Reference with {...obj}

Image description

Collapse
 
mohamed_karim_2dddebb42bd profile image
mohamed karim

Thank for sharing

Collapse
 
anurag_0503 profile image
Anurag Dubey

Impressive.