1var input = []; // initialise an empty array
2var temp = '';
3do {
4 temp = prompt("Enter a number. Press cancel or leave empty to finish.");
5 if (temp === "" || temp === null) {
6 break;
7 } else {
8 input.push(temp); // the array will dynamically grow
9 }
10} while (1);
11