News for hackers. Stuff that matters.
Re:Deep-copying in JavaScript by codeisawesome on Thursday January 25, 2018 @06:20PM (#16235699)
> If you don’t expect cyclic objects and don’t need to preserve built-in types, you get the fastest clone across all browsers by using JSON.parse(JSON.stringify()), which I found quite surprising.

I wonder if that’s because browser devs know by now that this is a widely used technique and hence optimise for it.

Re:Deep-copying in JavaScript by Havelock on Thursday January 25, 2018 @06:26PM (#16235737)
I suspect it is because JSON.parse and JSON.stringify are more commonly used methods and therefore see more optimization than methods use less.