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

180
Vistas
Difference between: new ExampleConstructor and Object.create(ExampleConstructor)

Code as attached

function Bird() {
  let weight = 15;
  this.getWeight = () => weight
}

// let birb = new Bird
let birb = Object.create(Bird.prototype);

console.log(birb.getWeight())

When I use new Bird it returns a function fine. However, when I use Object.create(Bird.prototype), I get a TypeError telling me birb.getWeight is not a function.

Why does creation from the prototype interfere with the function?

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

0

getWeight doesn't exist on the prototype. It is created on the object itself when the constructor function is run (which isn't happening when you use Object.create instead of calling the function).

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