Problem with Race Day Project

Hi.
i have just finished the Race Day project in the Introduction to JavaScript section.

https://www.codecademy.com/courses/introduction-to-javascript/projects/race-day

Everything turned out as expected except i noticed that raceNumber would always return a number greater than 1000 regardless of age and registration status. I have gone over the code a few times and watched the help video but still can not understand what went wrong.
Here is my code, any help would be appreciated.

let raceNumber = Math.floor(Math.random() * 1000);
const registeredEarly = true;
const runnersAge = 16;
if (registeredEarly && runnersAge > 18); {
raceNumber += 1000;
}

if (registeredEarly && runnersAge > 18) {
console.log(Your race will begin at 9:30am and your race number is ${raceNumber});
} else if (!registeredEarly && runnersAge > 18) {
console.log(Your race will begin at 11:00am and your race number is ${raceNumber});
} else if (runnersAge < 18) {
console.log(Your race will begin at 12:30am and your race number is ${raceNumber});
} else {
console.log(‘Please contact the registration desk’);
}

Your error lies in here:

The ; directly behind your if (registeredEarly && runnersAge > 18); causes the engine to ignore this line of code and skip to the next after which { raceNumber += 1000; } kicks in :wink:

Happy coding!

1 Like

Thanks you so much mate, I figured it was a small mistake I made somewhere but just couldn’t spot it.

Thanks again.

1 Like