Help, hopefully more readable this time


#1

console.log("An evil wizard called moldywart destryoed the human kingdom, killing thousands, the rest of the human race voweled to hunt down and kill the witches and wizards aswell as other beasts");

days = 0

var user = prompt('would you like to be a witch, wizard, technician, witch hunter, vampire or werewolf?').toLowerCase();

}
else {
console.log("work with the other members of your team to complete your goal");
}
switch(user) {
case 'wizard':
console.log("Brilliant, your goal is to survive and restore peace to the world, your allies are the witches");
if(days == 0 && days < 1) {
console.log("This is the first day of your journey, your goal is to survive and attempt to resolve the conflict")
}
else {
console.log("not working")
}
break;
case 'witch':
console.log("Brilliant, your goal is to survive and restore peace to the world, your allies are the wizards");
if(days == 0 && days < 1) {
console.log("This is the first day of your journey, your goal is to survive and attempt to resolve the conflict")
}
else {
console.log("not working")
}
break;
case 'technician':
console.log("you develop machinery and new technology to assist the witch hunters and possibly hunt them yourself");
if(days == 0 && days < 1) {
console.log("This is the first day of your journey, your goal is to create weaponry for the witch hunters")
}
else {
console.log("not working")
}
break;
case 'witch hunter':
console.log("you use advanced tools and weaponry provided by the technicians to hunt down the witches, wizards and other beasts");
if(days == 0 && days < 1) {
console.log("This is the first day of your journey, your goal is to kill all witches and wizards, aswell as other beasts")
}
else {
console.log("not working")
}
break;
case 'vampire':
console.log("you and the werewolf are on your own, you can team up as allies and must turn everyone else into a beast, you are hated by all")
if(days == 0 || user = 'vampire') {
console.log("This is the first day of your journey, your goal is to survive and spread the vampiric disease")
}
else {
console.log("not working")
}
break;
case 'werewolf':
console.log("you and the vampire are on your own, you can team up as allies and must turn everyone else into a beast, you are hated by all")
if(days == 0 && days < 1) {
console.log("This is the first day of your journey, your goal is to survive and spread the werewolf disease")
}
else {
console.log("not working")
}
break;
default:
console.log("you will be randomly assigned a role then" );

}

I am getting the unexpected token '}' error, i need some help debugging as i cant see anything wrong with my code


#2

Here i have highlighted where your errors are

console.log("An evil wizard called moldywart destryoed the human kingdom, killing thousands, the rest of the human race voweled to hunt down and kill the witches and wizards aswell as other beasts");;

days = 0;

var user = prompt('would you like to be a witch, wizard, technician, witch hunter, vampire or werewolf?').toLowerCase();

//====================================================================
//========================Your error was here=========================
// You just had } and then your wlse but no if complete it below

if(condition/*something*/){
    //Do something;
}

//======================================================================

else {
    console.log("work with the other members of your team to complete your goal");
}
switch(user) {
    case 'wizard':
        console.log("Brilliant, your goal is to survive and restore peace to the world, your allies are the witches");
        if(days == 0 && days < 1) {
            console.log("This is the first day of your journey, your goal is to survive and attempt to resolve the conflict");
        }
        else {
            console.log("not working");
        }
        break;
    case 'witch':
        console.log("Brilliant, your goal is to survive and restore peace to the world, your allies are the wizards");
        if(days == 0 && days < 1) {
            console.log("This is the first day of your journey, your goal is to survive and attempt to resolve the conflict");
        }
        else {
            console.log("not working");
        }
        break;
    case 'technician':
        console.log("you develop machinery and new technology to assist the witch hunters and possibly hunt them yourself");
        if(days == 0 && days < 1) {
            console.log("This is the first day of your journey, your goal is to create weaponry for the witch hunters");
        }
        else {
            console.log("not working");
        }
        break;
    case 'witch hunter':
        console.log("you use advanced tools and weaponry provided by the technicians to hunt down the witches, wizards and other beasts");;
        if(days == 0 && days < 1) {
            console.log("This is the first day of your journey, your goal is to kill all witches and wizards, aswell as other beasts");
        }
        else {
            console.log("not working");
        }
        break;
    case 'vampire':
        console.log("you and the werewolf are on your own, you can team up as allies and must turn everyone else into a beast, you are hated by all");;
        if(days == 0 || user == 'vampire') { // user = 'vampire' is incorrect
            console.log("This is the first day of your journey, your goal is to survive and spread the vampiric disease");
        }
        else {
            console.log("not working");
        }
        break;
    case 'werewolf':
        console.log("you and the vampire are on your own, you can team up as allies and must turn everyone else into a beast, you are hated by all");
        if(days == 0 && days < 1) {
            console.log("This is the first day of your journey, your goal is to survive and spread the werewolf disease");
        }
        else {
            console.log("not working");
        }
        break;
    default:
        console.log("you will be randomly assigned a role then" );
}

#3

Thanks heaps, was finally able to pass :smiley: