function Timer() {
this.seconds = 0;
this.tick = () => { this.seconds++; };
this.tickRegular = function () { this.seconds++; };
}
const t = new Timer();
const { tick, tickRegular } = t;
tick();
let regularResult;
try {
tickRegular();
regularResult = 'no error';
} catch (e) {
regularResult = e instanceof TypeError;
}
console.log(t.seconds, regularResult); Post #3494
1.5K
CHALLENGE
- ❤ 4
- 👍 1