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

143
Vistas
Are object variables with the same address always identical in JavaScript?

This question seems a bit silly but I just wanna confirm my understanding.

  1. I'm learning about comparision in JavaScript and it seems to me that if two ojbects have the same address then they should definitely be equal (b/c basically they are one?). Is this always true?

  2. bonus question: in the case I do want to implement this address comparision (shallow comparision), can I do it in pure JS without Object.is or ===?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Two objects cannot occupy the same location, either in our physical universe or in the twisted javascript universe. What you can have are two objects whose values are references to the same memory location.

var x = [1, 2, 3]
var y = x

So, the array [1, 2, 3] might be stored in some memory address, let's say it starts at 00A4. The variable x will be stored in some different place in memory, let's say 0108, and the actual value stored in that location is the number 00A4, that represents the memory location of its referenced value. Now, y will be then store in another totally different memory location, let's say 020F, and its value will also be 00A4, the memory location of its referenced value.

  1. Both x and y are variables whose values are references, that ultimately point to the same address. Reference values that point to the same address are always equal when compared.

  2. Javascript doesn't have any low-level semantics like this to manipulate memory addresses. You could do that maybe by using c procedure calls or something.

about 4 years ago · Juan Pablo Isaza Denunciar
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