Code your own adventure


#1

Why is it that my if and else statements are always just displaying the if console.log value even if it goes against the rule I have in place of "if"?

confirm("I am ready to play!");
var age=prompt("What's your age");

if(Age < 13)
{
console.log("Seek supervision");
} else
{
console.log("Play on!");
}

{
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 this game 1 out of 10");

if (feedback > 8)
{
console.log("Thank you! We should race at the next concert!")
} else {
console.log("I'll keep practicing coding and racing.")
}

For example based on my game, if I say I am 25 for example, it should say play on but it still says seek supervision on the results page to the right.

Any idea why and other mistakes you may have notiiced in my game?

Thank you,


#2

@shuabe,
First you define
age ( with all lowercase )
then you use
Age ( capitalized, first-letter in uppercase )