class Counter {
constructor() {
this.count = 0;
}
increment() {
this.count++;
return this.count;
}
}
const counter = new Counter();
const boundInc = counter.increment.bind(counter);
const rebind = boundInc.bind({ count: 100 });
console.log(boundInc(), rebind(), counter.count); Post #3476
1.92K
CHALLENGE
- ❤ 2
- 👍 2
- 🔥 2