Use setTimeout instead, and it is also a non-blocking method for async JS:
var interval = 1000; function callback() { console.log( 'callback!' ); interval -= 100;
Do not use setInterval , as in some cases (many setInterval + long callbacks, which are usually longer than the timeout) due to the limited queue size, some callbacks will be deleted by the browser and never executed . Only setTimeout guarantees execution.
source share