xxxxxxxxxx
while (true) {
// code block to be executed repeatedly
}
xxxxxxxxxx
// Infinite loop with the terminating condition set to infinity
for (var i = 0; i < Infinity; i++) {
// statements
}
// Also you can try
for (;;) {
// statements
}
javascript infinite loop with delay
xxxxxxxxxx
var delay = 2000; // interval in ms
var myInterval = setInterval(function() {
// code to execute every `delay` milliseconds
}, delay);
// Call this to stop it
clearInterval(myInterval);