I need to have a never ending loop in javascript. This will be almost like set interval. But for each loop the time delay need to be applied dynamically. The delay value will be changing on each loop. So is it possible to use while with some kind of sleep function? Or is it possible to change the set interval time for each iteration?
following code didn't give the delay. Always take the first value given to it.
<script>
var someTimeoutVar = 1000;
var inc = 1;
setInterval(function() {
inc++;
someTimeoutVar = inc * 1000;
console.log(someTimeoutVar);
}, someTimeoutVar)
</script>