问题
Especially when using while loops scenarios can arise where javascript gets stuck in a continuous loop that can crash the browser.
I usually handle this possibility by using a variable to count the number of while executions and break the while after a certain time.
While the browser no longer crashes it can still slow things down considerably.
Is there a more efficient way of handling this possibility?
来源:https://stackoverflow.com/questions/15676710/how-to-prevent-possible-javascript-memory-hogging-from-crashing-a-browser