{"id":1078,"date":"2023-05-21T06:09:06","date_gmt":"2023-05-21T06:09:06","guid":{"rendered":"https:\/\/itnotes.apjsoftwares.com\/?p=1078"},"modified":"2023-05-21T06:09:06","modified_gmt":"2023-05-21T06:09:06","slug":"what-is-the-working-of-timers-in-javascript","status":"publish","type":"post","link":"https:\/\/itnotes.apjsoftwares.in\/index.php\/2023\/05\/21\/what-is-the-working-of-timers-in-javascript\/","title":{"rendered":"What is the working of timers in JavaScript?"},"content":{"rendered":"\n<p>Timers are used to execute a piece of code at a set time or repeat the code in a given interval. This is done by using the functions&nbsp;<strong>setTimeout, setInterval,&nbsp;<\/strong>and<strong>&nbsp;clearInterval<\/strong>.<\/p>\n\n\n\n<p>The&nbsp;<strong>setTimeout(function, delay)<\/strong>&nbsp;function is used to start a timer that calls a particular function after the mentioned delay. The&nbsp;<strong>setInterval(function, delay)<\/strong>&nbsp;function repeatedly executes the given function in the mentioned delay and only halts when canceled. The&nbsp;<strong>clearInterval(id)<\/strong>&nbsp;function instructs the timer to stop.<\/p>\n\n\n\n<p>Timers are operated within a single thread, and thus events might queue up, waiting to be executed.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Timers are used to execute a piece of code at a set time or repeat&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[23],"tags":[],"_links":{"self":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts\/1078"}],"collection":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/comments?post=1078"}],"version-history":[{"count":1,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts\/1078\/revisions"}],"predecessor-version":[{"id":1079,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts\/1078\/revisions\/1079"}],"wp:attachment":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/media?parent=1078"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/categories?post=1078"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/tags?post=1078"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}