Please someone help me with if statement


#5

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 wont to race Biber 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.'");
}

it says:
Oops, try again. Did you add an if statement to your code?

that's all I have


#6

The story heats up! (Instructions)
Now you have to create different scenarios. Good thing we know how to do that using if / else statements.

If userAnswer is "yes", print out: "You and Bieber start racing. It's neck and neck! You win by a shoelace!"

Otherwise, print out: "Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'"

Remember: = is for assignment, and === is to check if things are equal!

Instructions
Use an if / else statement to write out the last part of this game!

Make sure to check the console for error messages and suggestions for how to fix them.


#7

refresh your browser .its working. :slight_smile:

@takiliki


#8

it doesnt working , maybe the prompt box is not ok, in it I wrote yes


#9

now is it working????

@takiliki


#10

no, it doesnt working :frowning:


#11

which browser you are using?

@takiliki


#12

thank's a lot, I will try agan :wink:


#13

now is it working????

@takiliki


#14

Can someone tell me whats wrong with this code???

var age = prompt("What's your age?");
if (age is less than 10)
{
console.log("Sorry, your too young.");
}
else (age is more than 9)
{
console.log("Have fun playing!");
}


#15


#16

The token sequences age is less than and age is more than are not defined (and are not even valid syntax!). You need to use a comparison operator, such as > or <.


Javascript help. Cant figure out what is wrong with this line of coding
#17

This is what i got now.


#18

Instructions read:

3.Then write an if/else statement. If age is less than 13, use console.log to tell the user that they're allowed to play but you take no responsibility.

Are you sure you followed this step?

Also, you can format your code by pasting it between two pairs of three backticks (`).


#19

no. it is still not working
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.' ");
}

Oops, try again. Did you add an if statement to your code?


#20

I've found solution. In this lesson should be TWO if statement. :(((((


#21

Rost, I ran your code and it passed in my console... And if you are referring to @takiliki's question, only one if statement is added in this section.


#22

I think evryting is ok, mabye it beacause you delete var age , but mabye I am not sure


#23

A post was split to a new topic: If statement


#24