5/6 help i dont understand why this wont work


#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?').toUpperCase();

if(user == 'vampire' || user == 'werewolf') {
console.log("in order to survive you must play smart and     team up with other werewolves and vampires as both the         witches and wizards, aswell as the humans want you dead);

}
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(day == 0 && day < 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(day == 0 && day < 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(day == 0 && day < 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(day == 0 && day < 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(day == 0 && day < 1) {
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(day == 0 && day < 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");
}

Above is my whole code, but i believe it is the following lines that are not working

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

if(user == 'vampire' || user == 'werewolf') {
console.log("in order to survive you must play smart and     team up with other werewolves and vampires as both the         witches and wizards, aswell as the humans want you dead);

}
else {
console.log("work with the other members of your team to complete your goal");
}

If i use one = sign to compare what the user inputted, it says invalid left hand assignment, if i use more than one = sign, it says im using an Invalid token


#2

Kind of hard to read :smile: So I just had a quick look, but here's what I notice

You're converting what the user enters to uppercase but the strings in your switch statement are all lower case. Also I think you've made a mistake with variable days and then your check is for day


#3

yeah sorry about the legibility, ill go see if that was the problem thankyou :smiley:


#4

yeah its still coming up with an invalid left hand assignment, i believe its not accepting the = sign values in the small segment of code i attempted to separate


#5

I think the problem is that you call method "toUpperCase()" for you variable and you use in switch case lower char. Try to use (user == 'VAMPIRE' || user == 'WEREWOLF')

switch(user){
case 'VAMPIRE'
....

}

or
remove ..toUpperCase() from your var user =....