Code your own adventure token {


please help me find the mistake! its an unexpected token { response that i am getting.

var user = prompt("You are walking in the forest and see a dinosaur!! What do you do? Run, hide or attack the velocioraptor?").toUpperCase();
switch(user) {
case 'ATTACK':
console.log("Thats a crazy idea!");
var attackOne = prompt("Do you hit it with an axe");
var attackTwo = prompt("Do you then throw a javelin?");
if(attackOne == "yes" && attackTwo == "yes") {
console.log("Wow! You're quite the fighter, good job the raptor is dead!"); } else (attackOne =="no" || AttackTwo == "no") {
console.log("You can't just stand there and expect to live!");

case 'RUN':
    var run = prompt("Are you fast or slow?").toUppercase();
case 'HIDE':
    var hide = prompt ("Do you hide in a tree or in a cave?").toUppercase();
    console.log("That't not a choice, please choose run, hide or attack.");



Your else statement is set up wrong. Else statements don't take a condition.It's what runs if nothing qualifies the if or else if.


thanks! i fixed it!!


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