Please someone help me with if statement


#1

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.'");
}

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


#2

Your "if" statement is fine. It's your last console.log statement. You sy the sentence inside the console.log in ". Then you ended it with '". You should have ended it with ". Whatever you start it with, you gotta end it with.


#3

I do that, but agen it says:
Oops, try again. Did you add an if statement to your code?
:what 's wrong :frowning:


#4

can you give me your full code?

@takiliki


#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. :(((((