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

109
Vistas
Usage of Object.create vs new

Are the following two constructions identical, or are there any differences between them?

let x = new Item(v1, v2, ...)

And:

let x = Object.create(Item.prototype)
x.constructor(v1, v2, ...)

The code I was writing to see which one to use is the following (though for academic purposes):

'use strict';
function Meal(type) {
    this.type = type;
};
Meal.isMeal = function(obj) {console.log(obj instanceof Meal)};
Meal.prototype.eat = function() {console.log(`${this.type} has been eaten!`)};

// let breakfast = new Meal('Breakfast');
let breakfast = Object.create(Meal.prototype);
breakfast.constructor('Breakfast')

Meal.isMeal(breakfast);
breakfast.eat();

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