If you enter yes
, the JavaScript asynchronously attempts to trigger a page reload.
This means that when the event loop isn’t busy doing something else, the browser will be told to reload the page.
However, the event loop is permanently busy because counter==0
so the while
loop will never end.
You need to exit the while
loop before the reload will happen.
1
solved JavaScript Validation not working on while loop