Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

134
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda