Kylie Soderblom2,699 Points
is there a way to use parseint with the prompt? If you are prompting for & expecting a number, change it once right away
ideally - var essentialNumber = parseint(prompt("Give me a number.")); Changing it once and not each time you have to use it later. otherwise you have to var once = prompt("Give me a number"); var twice = parseint(once);
Jason AndersTreehouse Moderator 145,228 Points
parseint at the prompt would work if you're expecting a number, but remember a number is only what you are "expecting".
You can't trust users to always do what is expected. Just because a number should be entered into the prompt doesn't mean a number will be entered into the prompt. The user may want out and try "exit" or "quit" ... or really type anything in there for no reasons at all.
So, it is best to have the input come in as is and then use some form of validation to ensure it is a numerical value before you use
parseint. This will save many headaches for you further down the line.
I hope that helps clarify your question.
Keep coding! :)