Heya, Lonsalot.
To build on what DMJPro mentioned, if the User presses 'Cancel' at the prompt, then the value of int will be false.
The problem with, for example, doing this:
is that 0 would also resolve to false, which would break out of the loop. This would not be ideal behavior, so instead we use:
to ensure that we only break the loop if the User clicks on the Cancel button.
Random, but I thought I might as also well mention:
-
var intList = new Array(4);
-
This creates a new Array and sets the value of the first element to 4. It does not create an Array with 4 elements. In JavaScript, you do not need to know how big your variables will be when you create them.
Now then.
If you're getting a blank page, the code is probably generating an error. In which browser are you testing this script?