What is the difference between setTimeout() and setInterval() methods?
setTimeout() | setInterval() |
---|---|
It runs the code with the timeout. This function executes the JavaScript statement "AFTER" interval. | It runs the code in fixed time intervals depending upon the length of their timeout period. |
setTimeout(expression, timeout); |
setInterval(expression, timeout); |
BY Best Interview Question ON 29 Jun 2019