Code your own adventure 2 - 5. Logical Operatos


Hi everyone, I passed the cases, but cannot understand why case "independence day" will not go to my ELSE statement. Any advice is appreciated

Replace this line with your code. 
var user = prompt("What is your favorite movie?").toUpperCase();

  case 'TOTAL RECALL':
    var actor = prompt("Isn't Arnold the BEST?").toUpperCase();
    var governor = prompt("Is he a better actor or governor").toUpperCase();
    if(actor === 'YES' &&  governor === 'ACTOR')
      console.log ("Yeah, i hear you");
      console.log("HAH! I disagree");
    var character = prompt("Who's best: Bill Paxton, Will Smith or Jeff Goldblume?").toUpperCase();
    if(character === 'BILL PAXTON'||'WILL SMITH')
// this case consistently says "Those 2 were the best!"
      console.log ("Those 2 were the best!");
      console.log("Jeff Goldblum was trash!");
    console.log("I haven't seen that one");


because the if condition is always true.

strings are considered true, for example:

if('this is true'){
  console.log("i will always run");
} else {
  console.log("i will never run");

your or comparison is not good, on both sides you have to compare with character:

if(character === 'BILL PAXTON'|| character === 'WILL SMITH')


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.