Help and ideas required (Code your won adventure 2 lesson 5)


#1



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


I don't get it but sometimes it comes up with the error message: prompt is not a variable and sometimes it doesn't? Also I need some ideas how i can add some if/else statements with logical operators in there. Could you help? already a big thanks for taking your time to read this :wink:


var user = prompt("You wake up in the morning and suddenly you fall through the ground in a portal. You wake up in a strange world where you see a few weapons on the ground: a pair of daggers, a staff, a dark magic tome, a mace, a katana and a lance (include the a in your answer). Wich weapon are you going to choose?").toUpperCase();
switch (user){
    case 'A PAIR OF DAGGERS':
        console.log("You're going the way of the assassin! Very fast, very effective!")
        prompt("Are you happy with the choise you made?").toUpperCase()
    break;
    case 'A STAFF':
        console.log("The typical fire mage it is for you! It's still reliable!")
        prompt("Are you happy with the choise you made?").toUpperCase()
    break;
    case 'A DARK MAGIC TOME':
        console.log("The rather slow but very powerfull dark sorcerer! Kick some @*s")
        prompt("Are you happy with the choise you made?").toUpperCase()
    break;
    case 'A MACE' :
        console.log("The very tanky and high damagedealer guy but oh so slow!")
        prompt("Are you happy with the choise you made?").toUpperCase()
    break;
    case 'A KATANA':
        console.log("The sword is so light that you can dash out some quick strikes! With enough training, You'll become a swordsmaster!")
        prompt("Are you happy with the choise you made?").toUpperCase()
    break;
    case 'A LANCE':
        console.log("It's quite self explanatory really. A long lance that can have, in the right hands, someone utterly amazing capabilities!")
        prompt("Are you happy with the choise you made?").toUpperCase()
    break;
    default:
        console.log(user + " " + "can't be found. Reset the code and try a different weapon!");}


#2

You have to add some if/else statements to your cases.Use && and || at least one time each.

Here's how you can nest an if / else statement inside a case:

switch(month) {

case 0:

    if(day == 1) {
        console.log("Happy New Year");
    }
    else {
        console.log("Happy January");
    }

    break;

/* ... */

}


#3

Yeah I know that I have to use them but I just can't get any good idea's for how to use them with the && or || If you know what I mean