Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function countdown(n) {
- if (n===0) return;
- console.log(`${n}!`)
- setTimeout(countdown(--n), 1000)
- }
- // calls countdown n times instantly...
- // 1 second later, 10 timeouts expire and do nothing.
Add Comment
Please, Sign In to add comment