I keep receiving Expected an Identifier instead saw 'else' errors


#1

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<var user = prompt(“Merlin, the wizard, has appeared in your village and has chosen you to go on an adventure with him to reclaim the spellbook that was taken from him by his evil step-son Brad. Will you agree to go on this journey or stay where you are?”).toUpperCase();

switch(user) {
case ‘YES’:
var Warrior = prompt(" Do you know how to fight (YES or NO)?").toUpperCase();
var Magician = prompt(“Do you know any magical spells (YES or NO)?”).toUpperCase();
if (Warrior === ‘YES’ || Magician === ‘YES’){
console.log(“You are instantly transported to town 300 miles away with Merlin to begin the search for Brad.”) }
else {
console.log(“You are utterly useless and Merlin leaves you behind”)}
break;

case 'NO':
    var really = prompt("Really (YES or NO)?").toUpperCase();
    var positive = prompt("Are you positive (YES or NO)").toUpperCase();
    if (really === 'YES' && positive === 'YES'){
        console.log("Merlin leaves you behind and you end up staying in your small village regretting your decision and eventually dying alone and being forgotten.")}
    else {
        console.log("Merlin takes your inability to decide as a yes and takes you off to a town 300 miles away anyway to begin your search for Brad.")}
    break;
    
case 'MAYBE':
    console.log("Merlin takes your answer as a yes and transports you to a town 300 miles away to begin your search for Brad.");
    break;

default:
    console.log("There is no time for indecision!");

}
var user = prompt(“You arrive in this town and the two of you decide to split up and gather information. Which building do you enter?(The tavern, the brothel, or the market.)”).toUpperCase();

switch(user) {
case ‘THE TAVERN’:
var barkeep = prompt(“Do you talk to the bar keep for information? (YES or NO)”).toUpperCase();
var drunkered = prompt(“Do you talk to the drunk man in the corner? (YES or NO)”).toUpperCase();
var girl = prompt(“Do you talk to the pretty girl alone at a table? (YES or NO)”);
if (barkeep === ‘YES’){
console.log(“The barkeep asks for some money and he will tell you what he knows”)}
var money = prompt(“Will you pay the barkeep (YES or NO)?”).toUpperCase();
if (money === ‘YES’){
console.log(“The barkeep tells you that he heard of a man who came through town two days ago dressed in a cloak carrying a strange book. The man was confronted by the guards. The man then said some strange words and the guards exploded! The cloaked man then turned into a giant bird and flew north to the abandoned castle.”)}
else {
console.log(“He tells to beat it.”)}

    else if (drunkered === 'Yes'){
        console.log("You help the man up from the floor and put him in a chair. The man says thank you. You ask him why it is he is so drunk and he tells you he will tell you if you buy him another bottle of rum.")}
        var rum = prompt("Will you buy him another bottle of rum (YES or NO)?").toUpperCase();
        if (rum === 'YES'){
            console.log("The drunkered tells you that he was once engaged to a beautiful woman named Isabelle, but one day when they were out having a picnic, a giant bird came out of nowhere and grabbed her. It took her to this abandoned castle up north. He tried to follow them, but when he got to the castle there a was and undead dragon guarding with skeleton soldiers all around its walls. I barely made it out of there alive,  he said. She is gone forever. The man then left.")}
        else {
            console.log("The man grumbles, pukes, then falls asleep without answering your questions.")}
            
    else if (girl === 'YES'){
        console.log("You sit down with the girl, but before you can ask her any question she asks you if you would like to go up to her room above the tavern.")}
        var room = prompt("Will you go upstairs with her (YES or NO)?").toUpperCase();
        if (room === 'YES'){
            console.log("You follow her upstairs into her room. She begins to take her clothes off, when she pulls a knife out and tries to attack you. Will you run away or defend yourself?")}
            var run = prompt("Will you run or defend yourself?").toUpperCase();
            if (run === 'RUN'){
                console.log("You turn to run away, but she gets you in the back. As you stumble out the door you fall down the stairs and break your neck. Your journey is over!")}
            else {
                console.log("You defended yourself by sidestepping the girls attack and she falls down the stairs and breaks her neck. You then find a letter on her nightstand that says, 'Merlin will arrive to town with a stranger. Kill the stranger. He is the only one who can foil my plans.' You look at the bottom of the page and it is signed Brad.");
        }else {
            console.log("You walk away")}
            
    else {
        console.log("Your decision wasted time and you did not learn anything")}

}

I keep receiving these "Expected an Identifier instead saw ‘else’ " errors on line , “else if (drunkered === ‘YES’){”
“else if (girl === ‘YES’){”, and my last two ‘else’ statements. Can someone help explain why?


#2

For a project this big could you put it in a repl.it and link it? That way we can help you a little better.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.