0
How can one write an infinite loop?
4 Antworten
+ 3
Writing this kind of infinite loop in javascript is a very bad idea: the web page where your script reside will not respond anymore (and the browser/app running it could freeze, depending on how is implemented the page display ^^)...
If you need to execute some code infinitively, you must consider the use of setTimeout, setInterval or the modern requestAnimationFrame global functions to let time to the page/browser to handle display refresh and user interactions:
https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Timeouts_and_intervals
+ 2
while(true) or for(;;).
+ 1
Write a condition that remains true always
Like 1 == 1