for (var j=0; j<2; j++){
listno=prompt("Enter Item Code","0");
listno = parseInt(listno);
if (listno > 0) {
PRODUCT_WANT.push(PRODUCT_LIST[listno]);
WANT_PRICE.push(PRICE_LIST[listno]);
}
else {
alert('Invalid Product Code');
}
if (quantno > 0) {
quantno=prompt("Enter Quantity","0");
quantno = parseInt(quantno);
quantity.push(quantno);
}
else {
alert('Invalid Quantity');
}
}
The loop works but I don't want to have to set the loop count I want to be able to put it to eg 999 then be able to press cancel on the prompt and have the loop finish