Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

298
Vistas
How reference value types in Javascript works?

I'm learning Javascript, based on my knowledge that the reference type like object below is created in the heap, and point to a new piece of memory in the stack. But what happened when I've tried to declare an object like this:

let object = { id: 1223, title: 'test' };

and when I reassigned it:

object = { newId: object.id, newTitle: object.title };

I got:

object = { newId: 1223, newTitle: 'test' };

I'm so curious as to why this is possible, Has the property name gone when I reassigned the object? and How it works behind the screen?

Please give me some explanations, keywords, or documents.

Many thanks.

P/s. Something I forgot is that the = operator's associativity happened from right to left, so the object at this point was not mutated until the execution met the =. Maybe it is the answer for my question somehow.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda