Race day exercise

so, first, i don’t really have a question but i’m wondering why “But we didn’t plan for runners that are exactly 18! We’ll handle that by the end of the project.” was made into such a big deal… all i did was create an adult variable and set it equal to 18… I had no issues including 18 year olds into the control flow using >=.

Also, I used the ! symbol for people who registered late, in which case, I also need to change the registeredEarly variable to false…is this how it should be or did i do something wrong?

everything seems to be working correctly but i’m not sure if i’m just unaware that it’s incorrect.

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

let registeredEarly = true;
const adult = 18;
let runnersAge = 18;

//adult early registration numbers
if (runnersAge >= adult && registeredEarly) {
raceNumber += 1000;
}

if (runnersAge >= adult && registeredEarly) {
console.log(Number ${raceNumber}: Your race will begin at 9:30 am.)
} else if (runnersAge >= adult && !registeredEarly){
console.log(Number ${raceNumber}: Your race will begin at 11:00 am.)
}

if (runnersAge < adult){
console.log(Number ${raceNumber}: Your race will begin at 12:30 pm.)
}

hi @design9908744238

so may I asked if you’re still asking a question? Or seeking a explanation on the mechanisms of JavaScript? Certainly, your code works fine as the syntax itself have no issues.

Based on your codes written, you can refer to the following pseudos to confirm if my interpretation is correct.

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

let registeredEarly = true;
const adult = 18;
let runnersAge = 18;


// if runner's age more than/or equal to 18
// and have registered early,
// Add 1000 into Race Number
// Conclusion: Participants who are at least 18 and above, and have registered
// early, their race number will be between 1000-2000 range
if (runnersAge >= adult && registeredEarly) {
raceNumber += 1000;
}

// if runner's age more than/or equal to 18
// and have registered early,
// Print to console " Number xxxx: Your race will begain at 9:30 am. "
if (runnersAge >= adult && registeredEarly) {
console.log(Number ${raceNumber}: Your race will begin at 9:30 am.)
} 

// else if runner's age more than/or equal to 18
// and did not registered early,
// Print to console " Number xxxx: Your race will begin at 11:00 am. "

// Question from me; Is "else if" necessary in this problem?
else if (runnersAge >= adult && !registeredEarly){
console.log(Number ${raceNumber}: Your race will begin at 11:00 am.)
}

// if runner's age less than 18,
// Print to console " Number xxxx: Your race will begin at 12:30 pm. "

// Question from me; Can be this be placed on top
// as the first condition before the rest?
if (runnersAge < adult){
console.log(Number ${raceNumber}: Your race will begin at 12:30 pm.)
}

Hope it helps you in clearing your doubts.