pull down to refresh

Damn, people really go out of their way to reinvent shitty oop.
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));