0 votes
in JavaScript by
What is the use of setInterval in Javascript?

1 Answer

0 votes
by

The setInterval() method is used to call a function or evaluate an expression at specified intervals (in milliseconds). For example, let's log a message after 2 seconds using setInterval method,

setInterval(function () {
  console.log("Good morning");
}, 2000);
...