Race Day Problem - why doesn't my way work too?


I’ve seen from the other threads the correct way to solve the Race Day project, but I was wondering if someone could explain to me why my code doesn’t work? I’m sure this means that I don’t fully understand the concepts of conditionals, but I’d love to learn what I don’t know…

What’s the reason that I can’t make racerStatus=‘early’ and then have a conditional statement that checks if racerStatus is early (as opposed to using a binary solutoin? When I run this code, I do get ‘Early Adult’, but when I change racerStatus to ‘late’, I still get ‘Early Adult’…can someone help me understand why?


Here’s my code:

let raceNumber = Math.floor(Math.random() * 1000);
let racerStatus = ‘early’;
const racerAge = 29;
if(racerStatus = ‘late’ && racerAge>18) {
console.log(“Early Adult”);
if(racerStatus=‘late’ && racerAge>18) {
console.log('You will race at 9:30 am. Your race number will be ’ + raceNumber + “.”)
} else if(racerStatus != ‘early’){
console.log(‘Your race will be at 11:00 am. Your race number will be’ + raceNumber + “.”)

Hi @dannyaiken4544091920
You are using the assingment operater (=) when you’re actually trying to compare values (=== or ==).