Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

124
Views
Is there a language-level way to deep clone a JavaScript object?

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...

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!