# Code Review (Race Day project (intro to JS))

Hello!
I’m just looking for some feedback about this code, which fulfils the requirements of the Race Day project in the intro to JavaScript Syntax course but potentially could be revised, in particular I struggled with the raceNumber variable, and the way it was generating numbers.

``````[codebyte]
let raceNumber = Math.floor(Math.random() * 1000);
//below is where racers input their age and wether they registered early.
const earlyRegister = false;
const runnerAge = 17;
//below the conditional statement figures out their raceNumber(and reassigns this value);
if ((earlyRegister === false) && (runnerAge < 18)) {
raceNumber += 1000;
};

if ((earlyRegister === true) && (runnerAge > 18)){
console.log(`Your number for the race is \${raceNumber} and your race starts at 9.30am, best of luck!`)
} else if ((earlyRegister !== true) && (runnerAge > 18)){
console.log(`Your number for the race is \${raceNumber} and your race starts at 11.00am, best of luck!`)
} else {
console.log(`Your number for the race is \${raceNumber} and your race starts at 12.30pm, best of luck!`);
};
[/codebyte]
``````

Even if this is an alright way of writing the code, I’d appreciate the heads up

Thanks in advance, C

Hi @digital0384353304
I think in an exercise of this relatively small complexity, there is not so much potential of improvement as long as your code runs.
One thing I noticed though: I think this if statement is not what the exercise aks for:

In step 4, it says:

Create a control flow statement that checks whether the runner is an adult AND registered early.
Add `1000` to their `raceNumber` if this is true.

Also, you can simplify the syntax of the condition slightly:

``````if (!earlyRegister && runnerAge < 18)
``````
1 Like

Thank you for the feedback, that does make sense!

I think I was confused about what constitutes a control flow in this instance, but I can see how one if () statement is not exactly a flow!

Thank you mirja

1 Like