Race Day Help Syntax Error

I keep receiving error ‘SyntaxError: Unexpected token &&’

My code is below:

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

let early = true;

let age = 25;

if (early && age => 18){

  raceNumber += 1000;

}

if (early && age => 18){

  console.log(`Race will begin at 9:30 and your race number is ${raceNumber}.`);

}

else if (!early && age => 18){

  console.log(`Race will begin at 11:00 and your race number is ${raceNumber}.`);

}

else if (age < 18){

  console.log(`Race will begin at 12:30, your race number is ${raceNumber}.`);

}

I can’t figure it out! I’m sure it must be an easy fix I’m just totally missing!

Hi,

Don’t take these error messages too literally. Often, they just mean the error is in the vicinity of the marked code. Your && is completely fine, but consider how the greater-or-equal-to operand should be written.

Thanks! I changed ‘=>’ to ‘>’ and fixed!

Perfect, note the issue is that the > < always come before the = in <= or >=. :slight_smile:

1 Like