Code your won adventure 2.5 syntaxError


#1

code:
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!")
var choise1 = prompt("Are you happy with the choise you made?").toUpperCase()
var choise2 = prompt("Do you want to switch your equipment?").toUpperCase()
if (choise1 === 'yes' && choise2 === 'no'){
console.log("Great let's continue)}
else{
console.log("Restart the code an pick another one!")
break;
case 'A STAFF':
console.log("The typical fire mage it is for you! It's still reliable!")
var choise1 = prompt("Are you happy with the choise you made?").toUpperCase()
var choise2 = prompt("Do you want to switch your equipment?").toUpperCase()
if (choise1 === 'yes' && choise2 === 'no'){
console.log("Great let's continue)}
else{
console.log("Restart the code an pick another one!")
break;
case 'A DARK MAGIC TOME':
console.log("The rather slow but very powerfull dark sorcerer! Kick some @*s")
var choise1 = prompt("Are you happy with the choise you made?").toUpperCase()
var choise2 = prompt("Do you want to switch your equipment?").toUpperCase()
if (choise1 === 'yes' && choise2 === 'no'){
console.log("Great let's continue)}
else{
console.log("Restart the code an pick another one!")
break;
case 'A MACE' :
console.log("The very tanky and high damagedealer guy but oh so slow!")
var choise1 = prompt("Are you happy with the choise you made?").toUpperCase()
var choise2 = prompt("Do you want to switch your equipment?").toUpperCase()
if (choise1 === 'yes' && choise2 === 'no'){
console.log("Great let's continue)}
else{
console.log("Restart the code an pick another one!")
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!")
var choise1 = prompt("Are you happy with the choise you made?").toUpperCase()
var choise2 = prompt("Do you want to switch your equipment?").toUpperCase()
if (choise1 === 'yes' && choise2 === 'no'){
console.log("Great let's continue)}
else{
console.log("Restart the code an pick another one!")
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!")
var choise1 = prompt("Are you happy with the choise you made?").toUpperCase()
var choise2 = prompt("Do you want to switch your equipment?").toUpperCase()
if (choise1 === 'yes' && choise2 === 'no'){
console.log("Great let's continue)}
else{
console.log("Restart the code an pick another one!")
break;
default:
console.log(user + " " + "can't be found. Reset the code and try a different weapon!");}

error:
SyntaxError: Unexpected token ILLEGAL

I don't know what's illegal about what I wrote and can someone tell me if I'm doing the right thing or not?
That would be appreciated :slight_smile:


#2

Hi in this if statement

if (choise1 === 'yes' && choise2 === 'no'){
console.log("Great let's continue)}

you didn't closed the string "Great let's continue" then here you didn't close the else statement

else{
console.log("Restart the code an pick another one!")
break;

here too you didn't closed the string

if (choise1 === 'yes' && choise2 === 'no'){
console.log("Great let's continue)}

here too didn't closed the else statement

else{
console.log("Restart the code an pick another one!")
break;

...And so on it's the same error on your code since you have the same if and else statement


#3

Okay Thanks! I'll change it immediately!