Unexpected Token Case?


#1
var answer = prompt("what's your name?").toLowerCase();
var user = answer

switch(user) {
    case 'connor':
        console.log("Hey Connor!")
        break;
    case 'greg':
        console.log("Hey Greg!")
        break;
    case 'brittany':
        console.log("Hey Britany!")
        break;
    case 'cailin':
        console.log("I've made a huge mistake!")
        break;
    default:
        console.log("I don't know you!");
}
if(case 1 || case 2 == true) {
    return "Hello"}
    else{
        return "hi there!";
        }
if(case 3 && 5 == true) {
    return "Sup"}
    else{
        return "hey";
        }

#2

Hey @chenry831! You cant call the case outisde the switch statement but you could switch it to a string like this:

from this:

to this:

 if'connor' || 'greg' == true) {

Hope this heled if it didnt please reply saying so! Good Luck!


#3

Thanks so much, but now it says somethings wrong with the syntax, an illegal return statement:

var answer = prompt("what's your name?").toLowerCase();
var user = answer

switch(user) {
    case 'connor':
        console.log("Hey Connor!")
        break;
    case 'greg':
        console.log("Hey Greg!")
        break;
    case 'brittany':
        console.log("Hey Britany!")
        break;
    case 'cailin':
        console.log("I've made a huge mistake!")
        break;
    default:
        console.log("I don't know you!");
}
if('connor' || 'greg' == true) {
    return "Hello"}
    else{
        return "hi there!";
        }
if('brittany' && 'cailin' == true) {
    return "Sup"}
    else{
        return "yellow"
        }