Need help on First Move!


I am having a syntax error with my code and I have no idea what is wrong, I'm fairly new to coding.

console.log("Suddenly, Bieber stops and says, 'Who wants to race me?'");
var userAnswer = prompt("I will race you!");
var userAnswer = Prompt("Do you want to race Bieber on stage?");
if (userAnswer = "Yes");
    console.log("Come up on stage and let the race begin!");
    console.log("Just keep singing, Bieber!");


I believe you need console.log not nsole.log


Oops, my copy and paste was cut off there but it does say console.log! Corrected the word.


It would seem that you have stuff that you will work on in future lessons in this lesson so it might be worth going back and reading the directions to only include what you need for this lesson.


i see a couple of flaws, built in functions like prompt are case sensitive, so you can't have Prompt (should be all lowercase)

then this line:

if (userAnswer = "Yes");

a single equal sign means assign, for comparison use two or three equal signs

string comparison is case sensitive, just so you know

the semi-colon on this line, prevents the if/else clause from working properly


Thank you so much! It worked as I fixed the case sensitive flaws in the code.


this passes the exercise, but i think you will get into trouble in later exercise, see 1. instructions:
Under your existing code, print out the storyline

i don't see your existing code (which you created in the earlier exercises), you need this code, otherwise you get into trouble later, maybe revisit the older exercises?


confirm("I am ready to play!");
var age = prompt("What's your age?");
if (age < 13) {
// Check age of user and produce proper output
console.log ("Come back in a few birthdays, Youngin'!");
else {
console.log ("Prepare for battle, Lunch Meat!");
console.log("You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.'");

That code?


yes, that code. Otherwise you get stuck in the next exercise, this code combined forms the groundwork for the next exercise


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