Need help ASAP with #5 -- Code your own adventure 2


#1


I'm not sure where my error is on this exercise. Any help will be greatly appreciated! Maybe I'm just lost.... x____x

https://www.codecademy.com/en/courses/javascript-beginner-en-ZA2rb/0/5?curriculum_id=506324b3a7dffd00020bf661#


var user = prompt("You encounter Candy Land... Your 3 options are GUMMY, CHOCOLATE, or MINT. Which do you choose?").toUpperCase();

switch(user) {
    case 'GUMMY':
    var bears = prompt("Do you want BEARS or WORMS?").toUpperCase();
    var worms = prompt("Gummy worms are very squishy!").toUpperCase();
      if (bears === "BEARS" || worms === "WORMS") { 
        console.log("Mmm.. gummys are the best!!!");
        }
        else {
            console.log("You're missing out!");
        }
        break;
    case 'CHOCOLATE':
        var dark = prompt("Did you want DARK or MILK?").toUpperCase();
        var milk = prompt("Milk is yummy as well").toUpperCase();
        if(dark === "DARK" || milk === "MILK") {
            console.log("Both are yummy yummy");
        }
        else {
            console.log("Ahhh.. so you like white                chocolate");
        }
        
    break;
    case 'MINT':
        var peppermint = prompt("Do you like PEPPERMINT or WINTERGREEN?").toUpperCase();
        var wintergreen = prompt("They're both awesome").toUpperCase();
        if(peppermint === "PEPPERMINT" || wintergreen === "WINTERGREEN") {
            console.log("Oh so minty fresh!");
        }
        else {
            console.log("Not so fresh.....") {
           }
    break;
    default: 
        console.log("Pick one of the options, silly!");
    }


#2

As the error states, you have an extra opening curly bracket {. It's in your MINT Case:

case 'MINT':
        var peppermint = prompt("Do you like PEPPERMINT or WINTERGREEN?").toUpperCase();
        var wintergreen = prompt("They're both awesome").toUpperCase();
        if(peppermint === "PEPPERMINT" || wintergreen === "WINTERGREEN") {
            console.log("Oh so minty fresh!");
        }
        else {
            console.log("Not so fresh.....") { // <= remove this {
           }
    break;

#3

Thank you very much!! :slight_smile:


#4

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