Following constructor function and log code is given ...
function Car(brand, year, model, color, utilidad) {
this.brand = brand;
this.year = year;
this.model = model;
this.color = color;
this.utilidad = utilidad;
this.useFor = (prmt) => {
this.utilidad.push(prmt);
}
};
const toyota = new Car("Toyota", 2021, "Prado", "Red", "city");
toyota.useFor('mountain');
console.log(toyota);
Instead of getting the expected log data the code breaks with following message ...
TypeError: "this.utilidad.push is not a function"
Why does this happen?