class Counter {
constructor() {
this.count = 0;
}
incBy(value) {
this.count += value;
}
incByAmount(value, amount) {
this.count += value * amount;
}
}
let counter = new Counter();
counter.incBy(1);
//counter.count is 1
console.log("count is", counter.count);
counter.incByAmount(2, 5);
//counter.count is 11
console.log("count is", counter.count);