Hey Guys,please i need your help......the program was suppose group Adults and young guys on RACE day

let raceNumber = Math.floor(Math.random() * 1000);
let earlyReg = true;
const runnerAge = 25;
if (runnerAge > 18 && earlyReg  ); {
console.log('Your Number is '+ raceNumber+=1000);
}

 if (runnerAge > 18 && earlyReg  );{
   console.log('The time for your race is 9.30am, and your number is '+raceNumber+=1000);
 } else if (runnerAge > 18 && !earlyReg ){
   console.log('Your race will start by 11.00am and your number is '+ raceNumber+=1000);
     }else if (runnerAge < 18){
   console.log( 'All young registrant will start their race '+ 12.30pm);
 }

this is the URL…
(https://www.codecademy.com/courses/introduction-to-javascript/projects/race-day)

Am sorry guys …i am very new in programming forgive my flaws

Please post the URL of this exercise.

Hello, @oladelerotimi6629412. Welcome to the forums.

Please review this to see how to include code in a post without your original formatting being messed up by the forums’ markdown. After you edit your post, so we can see the code as you’ve tried it, we can be of more help. At first glance, however, you may want to review where ;'s do and don’t belong.

Thanks for editing your post. So, what happens when you try to run your code as is? Here’s what I get:
image

What could Invalid left-hand side in assignment mean? We have an assignment operator. In the referenced code += is such an operator. So, what is wrong with the expression on the left hand side of +=? If you only look as far as here: raceNumber+=1000 it seems okay, but the interpreter notices the additional operator to the left of raceNumber. That isn’t allowed. Let’s look at a more simple example:

> n = 5
5
> n += 2
7
> n + n += 2
repl:1
n + n += 2
^^^^^

ReferenceError: Invalid left-hand side in assignment

I see that same pattern 3 times in your code. Start with fixing that. Also consider what I mentioned before about ;'s.

Thanks a lot @midlindner …you are a saver …you just saved me another 2 hours …here is what i did finally:

let earlyReg = true;
const runnerAge = 10;
if (runnerAge > 18 && earlyReg  ); {
console.log('Your Number is '+ (raceNumber+=1000));
}

 if (runnerAge > 18 && earlyReg  );{
   console.log('The time for your race is 9.30am, and your number is '+ (raceNumber+=1000));
 } if (runnerAge > 18 && !earlyReg ){
   console.log('Your race will start by 11.00am and your number is '+ (raceNumber+=1000));
     }if (runnerAge < 18){
   console.log('All young registrant will start their race 12.30pm');
 }
2 Likes

You’re welcome. However, you still have an issue:
Here:

and here:

1 Like

Should it be removed

Oh yeah…removed …and still works fine…

1 Like