Frontend interview questions
Frontendinterviewquestions.com
About Us
About Us

Use of JavaScript clearInterval()

setInterval method sets up a recurring timer. It returns a handle that you can pass into clearInterval to stop it from firing: JS code:-

var myVar = setInterval(myTimer, 1000);

function myTimer() {
  var d = new Date();
  var t = d.toLocaleTimeString();
  document.getElementById("demo").innerHTML = t;
}

function myStopFunction() {
  clearInterval(myVar);
}

Other Important Topics
Top Git Interview Questions And Answers (2023)
Top Typescript Interview Questions And Answers (2023)
Top JavaScript Coding Interview Questions And Answers (2023)
Related questions
How to get the maximum count of consecutive 1's in an array
what are custom directives in Angular and how to create them
How to hit an API before the loading of the appComponent
What is Map in JavaScript
Front End Developer Interview Questions for Freshers
Front End Developer Interview Questions For 3 Years Of Experience
Front End Developer Interview Questions For 5 Years Of Experience
Top 90+ Angular Interview Questions And Answers
Top 20+ HTML5 Interview Questions And Answers
Top 30+ CSS Interview Questions And Answers
Top 100+ Javascript Interview Questions And Answers
© 2023 frontendinterviewquestions.com
Privacy PolicyDisclaimerContact Us