DEV Community

How to Copy Objects in JavaScript

John Au-Yeung on December 28, 2019

Subscribe to my email list now at http://jauyeung.net/subscribe/ Follow me on Twitter at https://twitter.com/AuMayeung Copying objects means maki...
Collapse
 
adnanbabakan profile image
Adnan Babakan (he/him)

Perfect!
Once I had this problem and it was giving me headache. Then I found out this.
BTW if you are embedding codes after three back ticks use javascript so your code gets highlighted.

Collapse
 
aumayeung profile image
John Au-Yeung

Thanks for reading!

I'll add the highlights

Collapse
 
josdazari profile image
Joshua Daza Rincon

thanks John, with JSON.parse(JSON.stringify(a)); save my day!!!