Given the following function:
let ticks = 0;
let clock = setInterval(() => {
console.log("tick", ticks++);
if (ticks == 10) {
clearInterval(clock);
console.log("stop.");
}
}, 200);
Why is the first thing logged to the console "tick 0" rather than "tick 1", since it is immediately incrementing ticks by 1 (ticks++)? Or, is it the case that JS sees "ticks" first and immediately logs that, then sees the ++ and increments it accordingly?