Adventure game problem


#1

It asks my age, whatever i put in there it sends my straight to "Do you want to race Bieber on stage?"
I dont think my if else statements are correct. Though code academy says it was right.

confirm("Are you ready to play?");

var age = prompt("Whats your age?");

if (age < 13) {

    console.log("You can play but i take no responsibility");

} else {
    console.log("You can play! Goodluck!");
}

console.log("You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.' ");

console.log("Suddenly, Bieber stops and says, 'Who wants to race me?'");

var userAnswer = prompt("Do you want to race Bieber on stage?");

if (userAnswer === "yes") {
    console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!");
} else {
    console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so i can race without pacing.'");
}

var feedback = prompt("Rate my game out of 10.");
if (feedback > 8) {
    console.log("Thankyou! We should race at the next concert!");
} else {
    console.log("I'll keep practicing coding and racing.");
}

#2

HI it's right..let says you put a age under 13 it will print

"You can play but i take no responsibility"

and if you put a age over 13 it will print

"You can play! Goodluck!"

and after that it's right the it aske you

"Do you want to race Bieber on stage?"

#3

Hi,

But when i copy my code and wack it in the console using the inspect tool on chrome, it doesn't work.


#4

I don't know about that try it here repl.it


#5

Hmm, its odd, when i run it the console logs are wrong, and yet on the right hand side in the black box, they are correct.


#6

Only the prompts are working, not the console.logs.


#7

Are you sure

the firt line is the console.log() in the else statement

console.log("You can play! Goodluck!")

#8

I think i understand now, should console.logs produce a popup box like the prompt does? I was wondering why the console.logs weren't popping up like the prompts do.


#9

no the console just log your string (that contain the story) the prompt aske you something to input... and no since you didn't print the prompt it won't be print.


#10

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