In the following code, "Blast Off!" displays one second after the 1 displays. But, if I change the function call to setTimeout(finish(), 1000) "Blast Off!" displays immediately after 1. Why does including the () change the timing?
let countDown= time => {
let timer = setInterval(function(){
console.log(time);
time--;
if (time==0){
clearInterval(timer);
let finish = ()=> {
console.log("Blast Off!");
}
setTimeout(finish, 1000);
}
1000);
};
let startNum = Number(prompt("What number should I start counting down from? "));
countDown(startNum);
Trying to understand the difference between setTimeout(finish, 1000)
and setTimeout(finish(), 1000)