It’s beginner’s question. I’m trying to understand setTimeout. I want to print each number after a delay of 2 seconds. However, I can only delay the whole function, not the numbers. Can anyone tell me how to do it?
function print() {
for (let i = 10; i >= 0; i--) {
console.log(i);
}
}
setTimeout(print, 2000);