const counter = {
count: 0,
increment() {
this.count++;
return this.count;
}
};
const inc = counter.increment;
const boundInc = counter.increment.bind(counter);
console.log([
counter.increment(),
inc(),
boundInc(),
counter.count
]); Post #2167
5.41K
CHALLENGE
- 👍 8
- ❤ 1