For some reason loops are just throwing me for a loop. I have issues creating and identifying the right variables to be increasing and what not.
Anyways, I have to use a loop to constantly prompt for a user to enter a number until they enter 0 and then adding all the inputs together.
So the base code I have for this is:
let numPrompt = +prompt("Enter a number");
if (isNaN(numPrompt)) {
numPrompt = +prompt("Enter a number");
}
while (numPrompt != 0) {
numPrompt = +prompt("Enter another number");
console.log(numPrompt);
}
which the loops works to keep asking for the input till 0. However I'm having an issue thinking of a way to keep track of the inputs and then sum them all together into 1 value.