{"id":1069,"date":"2011-02-23T00:05:32","date_gmt":"2011-02-23T00:05:32","guid":{"rendered":"http:\/\/www.phpmind.com\/blog\/?p=1069"},"modified":"2011-02-23T00:05:32","modified_gmt":"2011-02-23T00:05:32","slug":"what-is-difference-between-setinterval-and-settimeout","status":"publish","type":"post","link":"https:\/\/www.phpmind.com\/blog\/2011\/02\/what-is-difference-between-setinterval-and-settimeout\/","title":{"rendered":"What is difference between setInterval () and  setTimeout () ?"},"content":{"rendered":"<p>setTimeout execute javascript statement AFTER x interval.<br \/>\nFor example &#8211; setTimeout(\u201cexecute_something();\u201d, 2000);<br \/>\nThis is execute function execute_something() after 2 seconds. <\/p>\n<p>setInterval execute javascript statement EVERY x interval.<br \/>\nFor example &#8211; setInterval(\u201cexecute_something();\u201d, 2000);<br \/>\nThis is execute function execute_something() in every 2 seconds. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>setTimeout execute javascript statement AFTER x interval. For example &#8211; setTimeout(\u201cexecute_something();\u201d, 2000); This is execute function execute_something() after 2 seconds. setInterval execute javascript statement EVERY x interval. For example &#8211; setInterval(\u201cexecute_something();\u201d, 2000); This is execute function execute_something() in every 2 seconds.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[27],"tags":[],"class_list":["post-1069","post","type-post","status-publish","format-standard","hentry","category-javascript"],"_links":{"self":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1069","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/comments?post=1069"}],"version-history":[{"count":1,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1069\/revisions"}],"predecessor-version":[{"id":1070,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1069\/revisions\/1070"}],"wp:attachment":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/media?parent=1069"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/categories?post=1069"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/tags?post=1069"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}