6. Practice with Switch


#1


https://www.codecademy.com/courses/javascript-beginner-en-qDwp0/1/2?curriculum_id=506324b3a7dffd00020bf661


Oops, try again. Did you remember to put in your default block?


var candy = prompt("What's your favorite candy?","Type your favorite candy here.");

switch(candy) {
  case 'licorice':
    console.log("Gross!");
    break;
  case 'gum':
    console.log("I like gum!");
    break;
  case 'beets':
    console.log("...is that even a candy?");
    break;
  defult:
  console.log("That's different. But " + candy + " sounds good.");
}


#2

You misspelled word "default".


#3

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