← 문제 목록
중급
TypeScript
50P
this 타입 바인딩 오류
다음 TypeScript 코드에서 버그를 찾으세요:
TYPESCRIPT
class Counter {
count = 0;
increment() {
this.count++;
}
getIncrementer() {
return this.increment;
}
}
const counter = new Counter();
const inc = counter.getIncrementer();
inc();
console.log(counter.count);
0명 풀이 · 정답률 0%