What happens when you destructure a class method and a class-field arrow off an instance and call them?
class Counter {
count = 0;
increment() {
return ++this.count;
}
incrementArrow = () => ++this.count;
}
const counter = new Counter();
const { increment, incrementArrow } = counter;
console.log(incrementArrow());
console.log(incrementArrow());
console.log(counter.increment());
console.log(increment());
console.log("done");
The answer
Work out every line it logs, in order. Then check.
Checking your sign-in…