How to deeply clone an object in JavaScript? The simplest way is via JSON eg.

How to deeply clone an object in JavaScript? The simplest way is via JSON eg.

JSON.parse(JSON.stringify(obj))

See below for two alternatives which use browser APIs in unexpected ways.

The first one, the asynchronous PostMessage version runs 7 times faster than the JSON approach. These methods also have the advantage of working with circular references and non-serializable types like Dates, Sets, Maps and ArrayBuffers etc.

Something a little less wierd really needs to get built into JavaScript.

https://twitter.com/dassurma/status/955484341358022657

I’m inclined to agree with the libertarians in thinking of the USSR as an extreme social democratic state, ie.

I’m inclined to agree with the libertarians in thinking of the USSR as an extreme social democratic state, ie. a mixed economy but one with all the collectivist levers cranked up to 11. To think of it as being a genuinely new mode of production I think was just Leftist wishful thinking. In effect it was the product of a form of bourgeoise revolution.

Originally shared by Jeff Zahari