worldsering,
class Counter {
constructor(initialValue = 1) {
this.value = initialValue;
}
multiply(value) {
return this.value *= value;
}
}
var counter = (
counter => counter.multiply.bind(counter)
)(new Counter(1));
console.log([
counter(5) === 5,
counter(2) === 10,
counter(3) === 30,
counter(2) === 60,
]);