1st prompts still popping up on lesson 6; question about syntax


#1

Hi, everyone ! I'm learning JS (step 2, lesson 6)

1. I'd like to know whether I should keep having the 1st prompts (about my age, wanting to play and so on) popping up each time I change lessons
2. I do have a question about the following 2 ifs : how come they both work although one has quotes and the other doesn't ? Thank youououou :slight_smile:
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 the game 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.");
}


Replace this line with your code.


#2

This is a text string because of the quotation marks. What logs to the console?

If code carries over from lesson to lesson, it's building towards something.


#3

Thank you for your answer.
The console took it in and let me finish that step. But I thought after logging the code in that as a parameter it shouldn't be in between quotes. Hence my question :wink:


#4

Did you end up removing the quotation marks from that if condition? If so, what logged to the console if your answer was 'yes'?


#5

Sorry for the delay. No, I didn't as I could carry on.


#6

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