I am to make a script that will ask the user to enter numbers until they type quit. I have this working, but I am struggling with the final element where I have to calculate the number of entries (not sum) the user submitted not including the var - quit.
Any assistance would be greatly appreciated.
<script>
var userWord = "quit";
var numList = Array();
var total = 0;
do {
userWord = prompt ("Enter a number of the word quit");
userWord = userWord.toLowerCase();
numList.push(userWord);
}
while (userWord != "quit")
document.writeln("<p>");
for (t = 0; t < numList.length - 1; t++) {
document.write(numList[t]);
if (t < numList.length - 2) {
document.writeln(", ");
}
}
document.writeln("</p>");
</script>
numList.length - 1