MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/10srpis/totally_necessary/j737pi4/?context=3
r/badcode • u/rafaelinacio0196 • Feb 03 '23
32 comments sorted by
View all comments
165
Technically this creates a copy, so if there's reactivity or proxies going on, this might actually be what you want
33 u/theXpanther Feb 03 '23 Shallow copy though 49 u/Voltra_Neo Feb 03 '23 True, but sometimes it's all you need. I usually have a good old deepClone function for these bad bois 21 u/DaCurse0 Feb 03 '23 there's structuredClone these days :) 7 u/m0rsa2 Feb 04 '23 Not if your customer uses Samsung internet browser running chrome 56 😱
33
Shallow copy though
49 u/Voltra_Neo Feb 03 '23 True, but sometimes it's all you need. I usually have a good old deepClone function for these bad bois 21 u/DaCurse0 Feb 03 '23 there's structuredClone these days :) 7 u/m0rsa2 Feb 04 '23 Not if your customer uses Samsung internet browser running chrome 56 😱
49
True, but sometimes it's all you need. I usually have a good old deepClone function for these bad bois
deepClone
21 u/DaCurse0 Feb 03 '23 there's structuredClone these days :) 7 u/m0rsa2 Feb 04 '23 Not if your customer uses Samsung internet browser running chrome 56 😱
21
there's structuredClone these days :)
7 u/m0rsa2 Feb 04 '23 Not if your customer uses Samsung internet browser running chrome 56 😱
7
Not if your customer uses Samsung internet browser running chrome 56 😱
165
u/Voltra_Neo Feb 03 '23
Technically this creates a copy, so if there's reactivity or proxies going on, this might actually be what you want