Do you know what will be the output of this code?
JavaScript
const timer = {
seconds: 10,
start() {
setTimeout(() => console.log(this.seconds));
},
};
timer.start();
Show answer and explanation
The answer is 10.
The arrow function has no this of its own, so it uses the one from start(), which is timer. A regular function callback would lose it.