function Product(name, price) {
this.name = name;
this.price = price;
}
Product.prototype.discount = function(discount) {
this.price -= discount;
};
const product = new Product('Phone', 500);
product.discount(50);
console.log(product.price);
Ответ: 450
JavaScript test | #JavaScript