7. more practice with switch


#1


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


SyntaxError: Unexpected identifier


var answer = prompt("What day is it today?");

switch(Day) {
    case 'Monday':
    console.log("Pick up the kids at 1");
    break;
    case 'Tuesday':
    console.log("Pick up the kids at 2");
    break;
    case 'Wednesday':
    console.log("Pick up the kids at 3");
    break;
    case 'Thursday':
    console.log("Pick up the kids at 4");
    break;
    case 'Friday':
    console.log("Pick up the kids at 5");
    break;
     default
     console.log("Take it easy");
}


#2

Variable mismatch. Try using answer in the switch parameter.


#3

thanks for your response

i tried it like this
switch(Answer)
and i get the same problem


#4

ok i got it! Lower case a in answer and I was missing : after default

var answer = prompt("What day is it today?");

switch(answer) {
case 'Monday':
console.log("Pick up the kids at 1");
break;
case 'Tuesday':
console.log("Pick up the kids at 2");
break;
case 'Wednesday':
console.log("Pick up the kids at 3");
break;
case 'Thursday':
console.log("Pick up the kids at 4");
break;
case 'Friday':
console.log("Pick up the kids at 5");
break;
default:
console.log("Take it easy");
}


#5

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