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

185
Vistas
Why print object display prototype chain not as expected
function F () {
   this.a = 1;
   this.b = 2;
}
let o = new F(); // {a: 1, b: 2}

// add properties in F function's prototype
F.prototype.b = 3;
F.prototype.c = 4;
console.log(o)

Using Chrome's developer tools, I find the output as follows:

enter image description here

I'm really confused with this output. Who can explain the result.

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

0

Disclaimer: I am not entirely sure about this answer.

__proto__ refers to the object that is being constructed (it's part of the constructor).

[[Prototype]] is the object that is meant to prototype the current object.

about 4 years ago · Juan Pablo Isaza Denunciar

0

[[Prototype]] refers to the internal prototype that every object is created with. It is not accessible, for example

o.prototype.b

returns undefined.

The deprecated __proto__ is initially uncalled, and, when it is called, fills up with the values of [[Prototype]], hence the duplication. So,

o.__proto__.b

returns 3.

The preferred access method is to use the getPrototypeOf() static method of Object.

Object.getPrototypeOf(o).b

returns 3.

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