Trying to create a script that asks a user for a range of positive inputs and ends when a negative input is introduced. Then prints the sum and average of the inputs in an alert. Any idea why I'm getting an error on my if statement?
var value;
var sum = 0;
var HTMLout;
var i = 0;
do {
if(isNaN(value) {
alert("Enter a positive integer");
} else {
value = parseInt(prompt("Enter a positive integer", "Enter a negative integer to quit"));
sum += value;
i++;
}
} while(value != -1);
HTMLout += alert("The sum of these numbers is " + sum);
HTMLout += alert("The average of these numbers is " + sum/i);