Race Day Excercise | raceNumber always above 1000

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

let earlyRegistration = false;

let runnersAge = 18;

if (earlyRegistration === true && runnersAge > 18); {

  raceNumber += 1000;

} 

if (earlyRegistration === true && runnersAge > 18) {

  console.log(`Your race will start at 9:30 am and your race number is ${raceNumber}.`);

} else if (earlyRegistration === false && runnersAge > 18) {

  console.log(`Your race will start at 11:00 am and your race number is ${raceNumber}.`);

} else if (runnersAge < 18) {

  console.log(`Your race will start at 12:30 pm and your race number is ${raceNumber}.`);

} else if (runnersAge === 18) {

  console.log('Please come see the registration desk.');

}

I have browsed the forum to find my mistake, but I couldn’t. Everything works as expected, but the raceNumber will always be above 1000 even though it should be between 1-999 for runners that are younger than 18.

Could someone please let me know what I am doing wrong?

if (earlyRegistration === true && runnersAge > 18); // ; here is ending the if statement code block
// This is starting a new scoped code block that will always run
 {

  raceNumber += 1000;

} 
2 Likes

Wow, the devil really is in the detail. Thank you for helping out!

1 Like