Raceday help please?

Hi all

Could anyone help please?

I am a bit stuck with this one. As you can see from the below code, the racers registered late, so the ‘if (age => 18 && registeredEarly === true){’ command should not execute, but the ‘} else if (age => 18 && !registeredEarly === true’ should.

this outputs - You will race at 9:30 am with race number 395 GOOD LUCK

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

const registeredEarly = false;

const age = 19;

if (registeredEarly === true && age >= 18) {raceNumber += 1000};

if (age => 18 && registeredEarly === true){

console.log (You will race at 9:30 am with race number ,raceNumber , GOOD LUCK );

} else if (age => 18 && !registeredEarly === true){console.log (You will race at 11:00 am with race number , raceNumber , GOOD LUCK and register earlier next time!! );};

I’m a bit confused.

Thank you

Remember to format your code with the Screen Shot 2021-02-05 at 11.55.11 AM button and then paste your code text here: Screen Shot 2021-02-05 at 11.55.15 AM

That way more people can look at it and help you out quickly :slight_smile:

As a general debugging tip, note that you can always console log conditions:
console.log(4 < 5); to see what’s being triggered and what is not.

Sorry, I will try next time.

and yes I’m just looking at trying to work out where is wrong by changing values and logging the output.


One of these is not quite like the other. If we change it so they’re in the same order, it’s a little more obvious:

if (age >= 18 && registeredEarly === true) {}
if (age => 18 && registeredEarly === true) {}

=> indicates an arrow function (you’ll learn about them later), not a greater than or equal to symbol >=. The age >= 18 works properly. You have two places to fix this, then it should function correctly. It’s a tricky error to catch.

I’m not sure why you’re putting a space between console.log and the (). They should be together like console.log('log statement here');