It doesn't exactly skip no, this condition will always be true if it's yes or if it's no:
Code:
if (answer === 'YES' || answer === 'NO') {
so it need go no further. You did after all follow that with an else if and an else - neither of which are supposed to 'fire' if the previous if is satisfied.
Maybe what you want is:
Code:
var answer = window.prompt('Type YES, NO, or MAYBE. Then click OK.').toUpperCase();
if (answer === 'YES' || answer === 'NO') {
console.log('You said YES!');
} if (answer === 'NO') {
console.log('You said no. :(');
} else {
console.log('You rebel, you!');
}
Or perhaps:
Code:
var answer = window.prompt('Type YES, NO, or MAYBE. Then click OK.').toUpperCase();
if (answer === 'YES') {
console.log('You said YES!');
} else if (answer === 'NO') {
console.log('You said no. :(');
} else {
console.log('You rebel, you!');
}
Bookmarks