JS Coding Questions Logo
JS Coding Questions
#108💼 Interview💻 Code

What is the use of setInterval

Advertisement

728x90

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,

javascript
1setInterval(function () {
2  console.log("Good morning");
3  }, 2000);

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 23

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
108of476