pull down to refresh
class Discount { constructor(rate){ this.rate=rate; } apply (v) { return v * (1 - this.rate); } } const regularDiscount = new Discount(0.1); const premiumDiscount = new Discount(0.2); console.log(regularDiscount.apply(100)); console.log(premiumDiscount.apply(100)); console.log(regularDiscount.apply(200));