Javascript Race Day Project

Hello everyone I’m new to coding so I just copy and pasted my code for this project. But after the video walkthrough the times won’t change for adults that are not early and the ! doesn’t seem to be working.
let raceNumber = Math.floor(Math.random() * 1000);
let early = ‘false’
let runnerAge = ‘26’
if (early && runnerAge > 18) {raceNumber += 1000}
if (early && runnerAge > 18) {
console.log(Racetime is 9:30 am and race number is: ${raceNumber}.)}
else if (!early && runnerAge > 18 )
{console.log(Late adults run at 11:00 am and your race number is: ${raceNumber})}
else if (runnerAge < 18) {console.log(‘Youth registrants run at 12:30 (regardless of registration)’)}

To preserve code formatting in forum posts, see: [How to] Format code in posts

// You wrote:
let early = 'false'
let runnerAge = '26'

// It should be:
let early = false
let runnerAge = 26

If you use quotes, 'false' and '26' will be considered strings.
If you omit the quotes, then false will be a boolean and 26 will be a number.

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.