Unable to understand 2 subtopics in javascript

i am not able to understand betweeb settimeout() and setinterval()…

the setTimeout() is useful in cases where we want some code to execute at once after an interval and not immediately whereas setInterval() is useful where we want some code to execute repeatedly at a set interval.

1 Like

The above explanation was good enough, but if i want to explain it in simple words then I would like to say that
:red_circle:setTimeout() is a built-in function of JavaScript that is used to give ALERT to any user visiting that particular webpage.
:red_circle: whereas, setInterval() is a built-in function used to set a timer of something like this and display it to the user.

Thank you :blush: