For an assignment in class we're tasked with getting user input using the prompt(). I only want the prompt to accept 1 of 3 values.
Here is my code:
ounce = prompt ( "What size would you like your drink?\n8oz, 12oz, 16oz are the available sizes." );
while ( ounce!= "8oz" || ounce != "12oz" || ounce != "16oz")
{
alert ( "Please select a proper size: 8oz, 12oz, 16oz" );
prompt ( "What size would you like your drink?\n8oz, 12oz, 16oz are the available sizes." );
}
My intention is that when the user enters anything else but 8oz, 12oz, or 16oz it will tell them that that size is not available and them prompt them asking for their size again until they enter in one of those values. However my code as it stands is not working. Even if I enter in 8oz it says that is incorrect and asks me for my size again. I am a beginner in a beginner level course as you can tell so any help is appreciated.
&&instead of||. Also, you're not resetting theouncevariable on the second call toprompt.