Is there a language-level way to deep clone a JavaScript object that is supported by main browsers (desktop and mobile)? I've seen that eval(uneval(o)); is non-standard.
JSON.parse(JSON.stringify(o)); looks ugly. You don't fundemantally need to 'stringify' at the first place. Just copy the bytes from the object to somewhere else in the RAM. Anything done above this looks like an inefficiency to me.
I am surprised to see that there is not this kind of functionality in various languages...
All objects are actually clones of their respective prototypes...
There is a reason we have Object constructors. Meaning :: You can write an object constructor, and clone it as many times you as need to.
Of course this may not be the "language-level" way that you expect, but truly - that's the real procedural way JavaScript Objects are supposed to be created.
We don't do that because JavaScript is a relaxed language, meant to be programmer friendly and not a pain in the rear like they're trying to make it, so we forget our manners.
However, writing constructors for deep Objects is not an easy task at all. -But I'm pretty sure it is not all that impossible.