Calls passed function(fn) repeatedly at the interval given in milliseconds.(num)
Note* Calls passed function(fn) after a bare minimum number of milliseconds. Although
it can be longer depends on the number of events waiting on the async queue of the browser.
Returns the id of the thread fired to be used as a reference for clear Interval(id)
How setInterval and setTimeout are the same
- Both function take two parameters
- the first being a function and the second being an int
The number is the minimum number of milliseconds to wait before the passed function is run in the case of setTimeout but, with setInterval the function will run repeatedly with no regard for the previous run. In other words setInterval is non blocking and each call back exists independently of page state.