Race Day project: What is wrong with my code pls?

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

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

let earlyRegistration = true;

let age = 18;

if (age > 18 && earlyRegistration ) {

  raceNumber += 1000;

}

if(age > 18 && earlyRegistration) {

  console.log(`Adults with ${raceNumber} will race at 9:30 am.`);

}

else if (age > 18 && !earlyRegistration);

{ 

console.log(`Adults with ${raceNumber} will race at 11:00 am`);

}

else if (age < 18){ 

  console.log(`All youth with ${raceNumber} will race at 12:30pm `);

}

You have a semi-colon here:

else if (age > 18 && !earlyRegistration);

this interrupts the else if clause, causing an error in the next else if clause.

yeah i realised and took it off but wont still run. still stuck pls help.

Currently, there is nothing wrong with the code. But what happens is age is exactly 18? Have you accounted for that in any of the logic?

yes i did add this at the end of the code for runners who are exactly 18. And each time i run the code the console only prints the last “else” statement below.

else{

console.log(‘Please visit the registration desk.’)

}

Can we see an updated version of your code (full)?

This is the updated version and it will only log the last “else statement” which is " Please visit the registration desk".

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

let earlyRegistration = true;

let age = 18;

if (age > 18 && earlyRegistration ) {

  raceNumber += 1000;

}

if(age > 18 && earlyRegistration) {

  console.log(`Adults with ${raceNumber} will race at 9:30am.`);

}

else if(age > 18 && !earlyRegistration)

{ 

console.log(`Adults with ${raceNumber} will race at 11:00 am`);

}

else if(age < 18)

{ 

  console.log(`All youth with ${raceNumber} will race at 12:30pm `);

}

else{

  console.log('Please visit the registration desk.')

}

So then all good? Your code now seems to meet the requirements

Thanks but for the reason i dont know it wont run . maybe it has to do with the codecademy platform

Not run means what? You don’t see any output?

If you suspect the problem is with codecademy, you can always use another platform (codepen, jsbin, jsfiddle) to test this theory.

Yes the only output i see is the the last else statement in the code:

“Please visit the registration desk”

I have downloaded jsfiddle but dont really know to use it. I am new to all these. Any help will be welcomed

that is because age is 18:

let age = 18;

if you where to change this number, you should see different output.

downloaded? its a website: https://jsfiddle.net/, where you can run code

not sure what you downloaded. I mentioned websites on purpose. Given they involve no installation or complicated matters

but the problem don’t seem related to the codecademy platform, seems you struggle somewhat the flow of conditions.

:rofl: you are so correct.
I just realised setting the variable age to 18 will not run the first two console because the statements is checking for above 18.

thanks a bunch .
Thats how to learn lol :joy: