More on Control Flow in JS Q&A


#1

I'm on lesson All on your own, 8/14. My code is working but it is not returning the correct thing. Instead of So do I, Okay, or I love it, it says, You have entered an incorrect answer. Please try again. Which is my default. What is wrong please?

// Write your code below!
var question = prompt("Do you like friut?");
switch(condition) {
case 'yes':
    console.log("So do I!");
    break;
case 'so-so':
    console.log("Okay.");
    break;
case 'no':
    console.log("I love it!");
    break;
default:
    console.log("You entered an incorrect answer. Please try again.");
    break;
}

Thanks


#3

var question = prompt("Do you like friut?");
switch(condition)

The highlighted area is your problem the "condition" should be variable that you chose to use in the switch, in this case your variable is "question".

This will solve your issue.