Javascript comparisons not working with prompts, while loop, and !== -
what i'm trying prompt user repeatedly until 1 of accepted answers received. pretty easy stuff. while loop, however, making weird , annoying. here's got:
var plrchoice=prompt("would choose bulbasaur, charmander, or squirtle? (use lowercase characters)"); while(plrchoice!=="bulbasaur"||plrchoice!=="charmander"||plrchoice!=="squirtle"){ plrchoice=prompt("would choose bulbasaur, charmander, or squirtle?"); } this should work in theory, result infinite do/while, regardless of user inputs. in advance :)
those || should &&.
Comments
Post a Comment