Race Day Only last else statement prints

https://www.codecademy.com/paths/web-development/tracks/getting-started-with-javascript/modules/learn-javascript-control-flow/projects/race-day

Good afternoon,
So, my issue is the only print out that formulates is the last else statement:

else {console.log(‘Please approach the registration desk, thank you!’);

Now, the other if statements do not log. Is this an error. Thing is I do not get an error message. It is just blank.

This is the code I used during the exercise:

Blockquote
let raceNumber = Math.floor(Math.random() * 1000);
let early = true;
let age = 18;

if (early && age > 18){
raceNumber += 100;
}
if (early && age < 18){
console.log(Race will begin at 9:30. Your race number is: ${raceNumber}.);
}
else if(!early && age > 18){
console.log(Race will begin at 11:00. Your race number is: ${raceNumber}.);
}
else if(age < 18){
console.log(Race will begin at 12:30. Your race number is: ${raceNumber}.);
}
else {console.log(‘Please approach the registration desk, thank you!’);

In your code, you assign 18 to age. None of your if conditions evaluate to true with an age of 18. They are all either> 18 or < 18. May want to consider <= or >= where appropriate.

Or another else if conditional.

Thank you, I’m going to try it again. Thank you for the clarification.

1 Like