Need help on First Move!


#1


https://www.codecademy.com/courses/javascript-beginner-en-x9DnD/0/4?curriculum_id=506324b3a7dffd00020bf661


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!");
}
else 
{
    console.log("Just keep singing, Bieber!");
}


#2

I believe you need console.log not nsole.log


#3

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


#4

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.


#5

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


#6

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


#7

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?


#8

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?


#9

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


#10

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