Race start time

The console is printing everything everything except for when the runner’s age is then 18 and I am not sure why

let raceNumber = Math.floor(Math.random() * 1000);

const earlyRunner = false;

const age = 19;

if (earlyRunner && age > 18 ) {

raceNumber += 1000;


if (earlyRunner && age > 18) {

console.log(Start at 9:30 am ${raceNumber});

} else if (age > 18 && !earlyRunner) {

console.log(Start at 11:00 am ${raceNumber});

} else if (age < 18) {

console.log(Start at 12:30 pm ${racenumber});

} else {

console.log(‘See the registration desk.’);


Hi there,
I can see a few things that might be causing you issues.

When using curly brackets, remember that you need to use grave accents

console.log(`Start at 9:30 am ${raceNumber}`);

And if you look at this line, you should be able to see why there is an issue for runners under the age of 18.

As a heads up, you should also use >= 18 because otherwise, runners that are 18 will log “See registration desk”

And side note, remember to look at the errors thrown by the console. They can be a big help in figuring out what is wrong with your code. :slight_smile:

Thank you for your response. I am using ` back ticks for the curly brackets but still same issue and I do want the 18 year olds to see the registration, let me paste a screen shot

Look at the error that appears.

The little ^ is showing you where the error is occurring while—

ReferenceError is telling you what the error is.

(Remember, capitalization is important)


I am so stupid, thank you so much. I see it now, I have the raceNumber n as lower case, I just changed it and it worked. Thank you so much for your help

1 Like