- A Executes a function once after a specified time interval
- B Executes a function repeatedly at a specified time interval
- C Stops a function from being executed repeatedly
- D None of these
- Share this MCQ
Answer:
B
Share this MCQ
The setInterval()
function executes a function repeatedly at a specified time interval (in milliseconds).
To stop the function from being executed, you can use the clearInterval()
function.
This is useful when you want to perform a certain task at regular intervals, such as updating a value on a webpage or checking for new data from a server.
The clearInterval()
function is used to stop the function from being executed.
It takes the ID of the interval as an argument, which is returned by the setInterval()
function when it is called.
Share this MCQ