This is a simple question but I couldn't find anyone addressing it. 

Using chrome, running a program over localhost.
If I have a while loop that never breaks the condition, it causes the page to freeze, no erros and I cant even close the tab on chrome.

If I have a recursive function, that calls itself infinitely. A maximum call stack error will be thrown.

Why is there no fail safe for while loops? How can I avoid the page freezing when a while loop runs indefinitely?
(other than properly writing a while loop)