JavaScript | Asynchronous JavaScript | Question 6

Last Updated :
Discuss
Comments

What is the difference between setTimeout and setInterval?

setTimeout runs once, while setInterval executes repeatedly at intervals

setTimeout executes repeatedly, while setInterval runs once

Both execute functions immediately

Both are used for canceling asynchronous tasks

Share your thoughts in the comments