Coding your own adventure 2! help with 5/6


#1

Here is my code:

var user = prompt("You are home alone on a Saturday night. You are watching a scary movie and you here a noise coming from the basement. Do you investigate, hide or call someone?").toLowerCase();
switch (user) {
case 'investigate':
var weapon ("Do you have anything to defend yourself? yes or no?").toLowerCase();
var smart ("Are you smart?").toLowerCase();
if (weapon === 'yes'|| smart === 'yes') {
console.log("You should be okay!!");
} else {
console.log("You might die, be careful!"); }
break;
case'hide':
var location = prompt ("bathroom, bedroom, or closet?").toLowerCase();
if (bathroom === 'yes' || bedroom === 'yes' || closet === 'yes') {
console.log("Lock the doors no matter where you go!!");
} else {
console.log("I hope your strong"); }
break;
case 'call someone':
console.log("parents, friend or the police");
break;
default:
console.log("Good luck");
};

It says I have a syntax error. it expected ; somewhere. Can anyone help!?


#2

hi this part

var weapon ("Do you have anything to defend yourself? yes or no?").toLowerCase();
var smart ("Are you smart?").toLowerCase();

you missing prompt and =


#3

var user= prompt(" are you handsome?").toLowerCase();
switch(user){
case'yes':
console.log("good ■■■■");
break;
case'no':
console.log("good luck");
break;
case'dont know':
var height=prompt("are you tall?");
var body=prompt("do you have good body?");
var skin=prompt("do you have good skin?");
if(height === 'yes' &&body === 'yes' )
{
console.log("you are good looking mate!");
}else if(height === 'yes' && (body === 'yes'||skin==='yes')){
console.log("you can always improve either of them!");}
else
{
console.log("better luck next life!");
}
break;
default:
console.log("i dont get it");
}


#4

your bathroom bedroom and closet is not defined mate
instead of writing like....var location = prompt ("bathroom, bedroom, or closet?").toLowerCase();
if (bathroom === 'yes' || bedroom === 'yes' || closet === 'yes')
you should write like
....var location =prompt("bathroom,bedroom or closet?");
if(location==='bathroom'||location==='bedroom'||location==='closet')


#5

SyntaxError: unterminated string literal
Where I wrong?

var user = prompt("Da li zelis da igras igricu?" + " " + "DA ili NE ili MOZDA?").toUpperCase();

switch(user){
case 'DA':
console.log("Super! Ako je odgovor" + " " + user + " " + "ajde da igramo");
break;
case 'NE':
console.log("Steta! Odgovorio si sa" + " " + user);
break;
case 'MOZDA':
console.log(user + "?" + " " + "Jos nisi siguran da li zelis da se igras?");
var strah = prompt ("Da li se plasis? Odgovori sa Plasim se/Ne plasim);
var smor = prompt ("Ili te ne interesuje ova igrica? Odgovori sa Smor mi je/Nije mi smor");
if (strah === 'Strah me je' || smor === 'Smor mi je') {
console.log ("OK...Ili se plasis ili ti je dosadno. Ne moras da igras");
} else if (strah === 'Ne plasim se' && smor === 'Nije mi smor'); {
console.log("Ne plasis se i nije ti smor. Ne znam zasto onda nisi siguran da ces da igras igricu?);
} else {
console.log("Upisujes netacne odgovore, Koristi samo Plasim se/Ne plasim se ili Smor mi je/Nije mi smor")
{
break;
default:
console.log("Netacan odgovor. Koristi samo DA ili NE ili MOZDA");
}

Ignore questions. It is on Serbian lenguage :slight_smile: