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

231
Vistas
When I store an object in an array, what mechanism is at work here?
 let kim={
     a:1,
     b:2
}
console.log(kim);
let tip=["a","b",kim];
console.log(tip);
kim.a=2;
console.log(tip);
console.log(kim);

output

>{a: 1, b: 2}
['a', 'b', {…}]0: "a"1: "b"2: {a: 2, b: 2}:length: 3[[Prototype]]: Array(0)
['a', 'b', {…}]0: "a"1: "b"2: {a: 2, b: 2}length: 3[[Prototype]]: Array(0)
{a: 2, b: 2}

expect

{a: 1, b: 2}
['a', 'b', {…}]0: "a"1: "b"2: {**a: 1**, b: 2}:length: 3[[Prototype]]: Array(0)
['a', 'b', {…}]0: "a"1: "b"2: {a: 2, b: 2}length: 3[[Prototype]]: Array(0)
{a: 2, b: 2}

Kim.a was changed 1 to 2 after first tip print, but first tip print is changed 2 before kim.a changed. What mechanism is at work here?

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