#5 Logical Operators, I need help.. =(


I've been on this section for a week now. I can figure out what I'm doing wrong. First thing is the .toUpperCase(); It was giving me errors so I took it out. After that I think I was doing everything correctly. I guess not. Can someone help.. Thx in advance.. Here is my code:

var user = prompt("Your looking for an adventure this weekend. Do you drive a NASCAR, fly a FA-18 fighter JET, or go SKY diving?");

switch(user) {
   case 'nascar':
       var driving = prompt("Are you a good fast driver?", "(YES or NO or OK)");
          if (driving === yes || driving === ok) {
             console.log("You got 1st place! Job well done!");
         } else {
             console.log("Sorry you placed last!");
   case 'jet':
     console.log("Ok Maverick, lets suit up!");
     var fly = prompt("Two questions. Do you know how to fly and are you afraid of heights?);
         if (fly === yes && fly === no || fly === yes && fly === yes) {
             console.log("You fly like Ice Man!!")
         } else {
             console.log("Weeeeeee... SPLAT!");

    case 'sky':
       console.log("Weeeeee Splat!!");
    case 'all':
       console.log('Ok, then, when?');
       console.log('Go away if you dont understand the question');


Hey @jaepark75! Firstly dont forget to select over your code and hit CTRL + K to format your code so we can identify your code-error quickly. There is only one problem! You forgot to finish your quotation marks! Ima spot the problem for you!

Here is where the problem is:

Just change it to :smile:

var fly = prompt("Two questions. Do you know how to fly and are you afraid of heights?");

And you will be fine! If there is still some problems concerning you please reply saying so!


Thank You for the quick reply. That did help but I'm running into problems in the first option. When it prompts the first question and I choose "nascar" it prompts me to the next question... when I answer "yes" it says this

if I I'm not sure when to hit command K. In here where I'm writing now or when I'm working on the lessons.


You need to change all those answers as a string. :smile:

Like, they're not variables or values or keys or etc etc etc.... :smiley:

So every answer you get from the prompt must be a string.



Ok @jaepark75! I see your problems why do you have two strings???

Right here

Just put it as one string like this:
var driving = prompt("Are you a good fast driver? , (YES or NO or OK)");

Another one is in the if and else statement you didnt define the if statement as a string.


Should be like this:
if (driving === "yes" || driving === "ok") {
console.log("You got 1st place! Job well done!");

Do the same thing for all of them.

Thirdly this is just additonal but lowercase the anwser so it actually goes to your if statement

By doing the method .lowerCase();

Like this:

Any problems now?


Oh i didnt see your post @ragezapper! Sorry!


I fixed all the mistakes that you guys pointed out. I cant believe I didnt pick that up!! I'm running into a problem when I put the .lowerCase();



Sorry again i messud up with the Java. In java ts .lowerCase(); , but in Javascript it is .toLowerCase(); Sorry! And if you want uppercase, you do .toUpperCase();

Here is the documentation.


Dont be sorry. Now my next problem is the result of going thru this.. In the var fly = blah blah.. if else statement (yes && no || yes && no) its supposed to console.log( you fly like Ice Man ). Instead if console.log( Weeeeeee.... SPLAT! )

Do you know whats wrong with the code there?


A ScreenShot would be Lovely! Couldnt understand your problem correctly!



Can you try removing that .toLowerCase(); maybe that is the problem!


Well, since there's only one prompt... there can only be one answer....

I suggest you put another prompt and put another variable to say yes, no, yes and no, yes and yes, no and no, etc etc.

And .toLowerCase();

Does work, just an FYI


Hi will you or someone help me debug my code please Thank you in advance.:

var user = prompt(“What is your name?”).toUpperCase();
var user = prompt(“What is your favorite color?”).toLowerCase();

switch(user) {
case ‘purple’:
if(purple && blue your favorite color) {
console.log(“Purple is my favorite color too!”)
else {
console.log(“Bless your heart.”);
case ‘blue’:
console.log(“Blue is cool for the ocean.”);
case ‘red’:
console.log(“Do you squirm at the sight of blood?”);
console.log(“I don’t know if that is a color.”);



If you have a problem, please post this in a new thread with your question + code + error message in order to keep the forum clean.


I got the code to run by changing a few things:
var user = prompt(
“You’re looking for an adventure this weekend. Do you drive a NASCAR, fly a FA-18 fighter JET, or go SKYdiving?”
switch (user) {
case ‘nascar’:
var driving = prompt(“Are you a good fast driver?”, “(YES or NO or OK)”);
if (driving === true || driving === false) {
console.log(“You got 1st place! Job well done!”);
} else {
console.log(“Sorry you placed last!”);
case ‘jet’:
console.log(“Ok Maverick, lets suit up!”);
var fly = prompt(
“Two questions. Do you know how to fly and are you afraid of heights?”
if (fly === true && fly === false || fly === true && fly === true) {
console.log(“You fly like Ice Man!!”);
} else {
console.log(“Weeeeeee… SPLAT!”);
case ‘sky’:
console.log(“Weeeeee Splat!!”);
case ‘all’:
console.log(‘Ok, then, when?’);
console.log(‘Go away if you dont understand the question’);