Can you help me with my javascript code?

I am doing this code:

confirm(“I am ready to play!”);

var age = prompt (“What’s your age?”) ;

if (age < ) {

console.log (“Proceed at your own risk”);

} else {

console.log (“Good Luck”);

}

console.log (“You wake up in a cave and find yourself trapped in a room and find a torch and a door”) ;

console.log (“Be sure to choose the right one”);

userAnswer = prompt (“Do you take the door or the torch?”);

if (userAnswer===”torch”) {

console.log (“You take the torch and walk down the cave now that you can see”);

} else {

console.log (“You open the door only to see a brick wall in your way so you take the torch and go on”);

}

userAnswer = prompt (“Your torch is now losing its flame, do you either keep on going or walk through a nearby door”);

if (userAnswer ===”keep going”) {

console.log (“You keep going and your flame runs out, you hear noises coming towards you and then run back and go through the door. The door leads you to a teleporter which you jump through and end up in the batcave”);

} else {

console.log (“You chose to take the door which leads to a stairway to the batcave”);

}

userAnswer = prompt (“You are now in the batcave and see Batman, do you either ask him to lead you back home or attemp to fight him”);

if (userAnswer===”fight him”) {

console.log (“You attempt to fight Batman and he wins because he is batman. Now he knocks you out and throws you to the bottom of the batcave”);

} else {

console.log (“You ask batman for the way out and he drives you out of the cave and back home in his batmobile”);

See also  how do you create an app?

}

var feedback = prompt (“Rate the game -“);

if (feedback > ) {

console.log (“Thanks for enjoying this game!”);

} else {

console.log (“I slaved away at this game and you gave me that score?! The nerve! Just you wait”);

}

Everything seems to run perfectly when I run it except some parts of it won’t show up like the story when it says console.log and then the message I want them to see doesn’t show up. The only parts that pop are the user answers and the feedback. My question is, how do I get all of the messages (console.log) to show up when I run the code?

Answer
? Favorite Answer

  • The HTML code (with your Javascript replacing all console.log with alert) worked well for me:

    <html>

    <head>

    <body>

    <script>

    confirm(“I am ready to play!”);

    var age = prompt (“What’s your age?”) ;

    if (age < ) {

    alert (“Proceed at your own risk”);

    } else {

    alert (“Good Luck”);

    }

    alert (“You wake up in a cave and find yourself trapped in a room and find a torch and a door”) ;

    alert (“Be sure to choose the right one”);

    userAnswer = prompt (“Do you take the door or the torch?”);

    if (userAnswer===”torch”) {

    alert (“You take the torch and walk down the cave now that you can see”);

    } else {

    alert (“You open the door only to see a brick wall in your way so you take the torch and go on”);

    }

    userAnswer = prompt (“Your torch is now losing its flame, do you either keep on going or walk through a nearby door”);

    if (userAnswer ===”keep going”) {

    alert (“You keep going and your flame runs out, you hear noises coming towards you and then run back and go through the door. The door leads you to a teleporter which you jump through and end up in the batcave”);

    See also  What is the AutoCAD command &quot;RP&quot;, and why does it crash the program?

    } else {

    alert (“You chose to take the door which leads to a stairway to the batcave”);

    }

    userAnswer = prompt (“You are now in the batcave and see Batman, do you either ask him to lead you back home or attemp to fight him”);

    if (userAnswer===”fight him”) {

    alert (“You attempt to fight Batman and he wins because he is batman. Now he knocks you out and throws you to the bottom of the batcave”);

    } else {

    alert (“You ask batman for the way out and he drives you out of the cave and back home in his batmobile”);

    }

    var feedback = prompt (“Rate the game -“);

    if (feedback > ) {

    alert (“Thanks for enjoying this game!”);

    } else {

    alert (“I slaved away at this game and you gave me that score?! The nerve! Just you wait”);

    }

    </script>

    </body>

    </html>

  • Other Related Questions

    Learning Visual Basic ?

    Answers Favorite AnswerTry using "System.Diagnostics.Process. GetProcessesByName( "iwmp" ).Length > " for your check.

    Microsoft Office word Fast answer needed its urgent?

    Answers Favorite AnswerTry this:http://www.techsupport.com///microsoft-wo...Here is another thread re: the same issue with instructions:http://www.pcreview.co.uk/forums/modification-not-...http://www.techsupport.com///microsoft-wo...http://support.microsoft.com/kb/http://answers.microsoft.com/en-us/office/forum/of...

    Can I download a whole city android google maps?

    Answers Favorite Answer:) Yes!!!Interesting question. I wonder why it has blocked in this way especially considering that Google Earth is very detailed and has good maps of Israel.

    What is meant by ROM ? Explain in simple but elaborate terms.What about mobile ROM’s?

    Answers Favorite AnswerHi Diva below is a link that will give a simple answer.http://wiki.answers.com/Q/What_does_ROM_stand_for_...Hope this helps.Source(s): Experience and wiki answers.ROM is Read only memory. i.e data can write only once.There two types of ROM..ROM.PROMThe difference between ROM and PROM.that is ROM is programmed during manufacturing it means data stored by manufacturing company.PROM is blank memory that a user programmable memory.user can store content on PROM.both ROM and PROM are Read only memory Data can write only once.and its not possible to write so many time.Memories of PROM and ROM are Non-volatile in nature. Its that stored informations can retain even power goes off.

    See also  How can I write pseudocode instructions to carry out this computational operation?

    Leave a Comment