{"action":"created","issue":{"url":"https://api.github.com/repos/ga-wdi-exercises/final-countdown/issues/49","repository_url":"https://api.github.com/repos/ga-wdi-exercises/final-countdown","labels_url":"https://api.github.com/repos/ga-wdi-exercises/final-countdown/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/ga-wdi-exercises/final-countdown/issues/49/comments","events_url":"https://api.github.com/repos/ga-wdi-exercises/final-countdown/issues/49/events","html_url":"https://github.com/ga-wdi-exercises/final-countdown/pull/49","id":137138913,"number":49,"title":"Jblakeman solution","user":{"login":"jblakeman","id":4530217,"avatar_url":"https://avatars.githubusercontent.com/u/4530217?v=3","gravatar_id":"","url":"https://api.github.com/users/jblakeman","html_url":"https://github.com/jblakeman","followers_url":"https://api.github.com/users/jblakeman/followers","following_url":"https://api.github.com/users/jblakeman/following{/other_user}","gists_url":"https://api.github.com/users/jblakeman/gists{/gist_id}","starred_url":"https://api.github.com/users/jblakeman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jblakeman/subscriptions","organizations_url":"https://api.github.com/users/jblakeman/orgs","repos_url":"https://api.github.com/users/jblakeman/repos","events_url":"https://api.github.com/users/jblakeman/events{/privacy}","received_events_url":"https://api.github.com/users/jblakeman/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-29T03:23:00Z","updated_at":"2016-03-01T19:54:59Z","closed_at":"2016-03-01T19:54:59Z","pull_request":{"url":"https://api.github.com/repos/ga-wdi-exercises/final-countdown/pulls/49","html_url":"https://github.com/ga-wdi-exercises/final-countdown/pull/49","diff_url":"https://github.com/ga-wdi-exercises/final-countdown/pull/49.diff","patch_url":"https://github.com/ga-wdi-exercises/final-countdown/pull/49.patch"},"body":"Comfort level with this started out puzzled, as I was curious about why I couldn't get the countdown to go faster.  But even when counting down with the [setInterval](https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setInterval) delay at 0 or 1 milliseconds, the full countdown seemed to be taking around 5 seconds, when it should be taking around 1.234 seconds.\r\n\r\nMy next inclination was to time the function used in setInterval to see if it was causing the bottleneck.  As JavaScript runs on a single thread, its setInterval functions must wait for the last executing function to finish executing before the next can start.  The browser engine builds a queue for these functions that take longer than the interval [1].  Thus, a function that would take around 4 milliseconds to execute would explain this behavior as the next interval would be constantly waiting around 3 ms before the previous interval finished.  But after timing the function, it clocked at around 0.1 ms.\r\n\r\nFrom there, research directed me to the [setTimeout docs](https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout#Reasons_for_delays_longer_than_specified), and after reading through them more thoroughly, I realized that the [HTML5 spec](https://html.spec.whatwg.org/multipage/webappapis.html#timers) sets a minimum timer value of 4 milliseconds, which also gets applied to the `setInterval` method.  So, to conclude, it seems that in any browser that follows the HTML5 spec, a delay value < 4 sent to the `setInterval` or `setTimeout` methods will likely be overridden by the minimum timer value (4).\r\n\r\n[1][http://ejohn.org/blog/how-javascript-timers-work/](http://ejohn.org/blog/how-javascript-timers-work/)"},"comment":{"url":"https://api.github.com/repos/ga-wdi-exercises/final-countdown/issues/comments/190876548","html_url":"https://github.com/ga-wdi-exercises/final-countdown/pull/49#issuecomment-190876548","issue_url":"https://api.github.com/repos/ga-wdi-exercises/final-countdown/issues/49","id":190876548,"user":{"login":"RobertAKARobin","id":6268177,"avatar_url":"https://avatars.githubusercontent.com/u/6268177?v=3","gravatar_id":"","url":"https://api.github.com/users/RobertAKARobin","html_url":"https://github.com/RobertAKARobin","followers_url":"https://api.github.com/users/RobertAKARobin/followers","following_url":"https://api.github.com/users/RobertAKARobin/following{/other_user}","gists_url":"https://api.github.com/users/RobertAKARobin/gists{/gist_id}","starred_url":"https://api.github.com/users/RobertAKARobin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RobertAKARobin/subscriptions","organizations_url":"https://api.github.com/users/RobertAKARobin/orgs","repos_url":"https://api.github.com/users/RobertAKARobin/repos","events_url":"https://api.github.com/users/RobertAKARobin/events{/privacy}","received_events_url":"https://api.github.com/users/RobertAKARobin/received_events","type":"User","site_admin":false},"created_at":"2016-03-01T19:54:59Z","updated_at":"2016-03-01T19:54:59Z","body":"Woah, I never noticed this! Come to think about it, I guess it does take rather a long time, huh? Thank you for pointing this out! I'm sorry if it caused any confusion!"}}