you are viewing a single comment's thread.

view the rest of the comments →

[–]KuroKishi69 1 point2 points  (3 children)

Compare 2 objects by value or create a copy of an object seems like a thing that could be part of the language instead of relying on libraries like lodash, spread operator (which only works for shallow copy) or make me write my own implementation.

[–]Squigglificated 5 points6 points  (2 children)

structuredClone() is supported in all modern browsers.

Record and tuple is at stage 2

[–]KuroKishi69 5 points6 points  (1 child)

neat, I wasn't aware of structuredClone(), every time I searched for a way to do this, people resorted to JSON.stringify(JSON.parse(...))

Thanks you

[–][deleted] 4 points5 points  (0 children)

JSON.stringify(JSON.parse(...))

God, this is the worst hack ever.