I have a basic do while loop where I am executing a prompt's input value, then running it through the condition. For some odd reason when I use !== along with || in the same condition it does not work. I know that I can add additional parameters for it to compare against using isNaN and other logical operators, but it makes no sense why this does not work and I would like to get this route working.
var number;
do {
number = parseInt(prompt('Enter 1 or 2'));
}
while ((number !== 1) || (number !== 2));
If I were to run the following code with a single expression to compare against, it work no problem, but in the previous statement it does not like have multiple conditions to compare against.
var number;
do {
number = parseInt(prompt('Enter 1 or 2'));
}
while (number !== 1);
Thanks!
numberis not 1 AND is not 2.!(number===1 || number===2), or(number!==1 && number!==2)