JSFiddle - React, Tailwind, and code Playground
HTML
abc
JavaScript
class User {
constructor(id, name, age) {
}
}
class Buyer extends User {
constructor(id, name, age, purchaseHistory) {
super(id, name, age, 25000);
this.purchaseHistory = purchaseHistory;
}
addToPurchaseHistory(purchase) {
console.log(`user = ${this.name} purchased ${purchase}`);
this.purchaseHistory.push(purchase);
}
}
user = new Buyer(1, "abc", 10, 1500);
console.log(user);
console.log("abc");