Race Day Project. Last task Issue

So I am trying to add a last else statement but when I do it turns green. When I run the program it says I have an unexpected token. If I delete my last else line of code the project runs just fine. So what am I not doing correctly?

This is my code:
let raceNumber = Math.floor(Math.random() * 1000);
const earlyRegistration = true
let runnersAge = 21
if(earlyRegistration === false){raceNumber += 1000;}
if(earlyRegistration === true && runnersAge > 18) {
console.log(‘You’re race number is ’ + raceNumber +’ and your race is at 9:30 am.’);
} else if(earlyRegistration === false && runnersAge > 18) { console.log(‘You’re race number is ’ + raceNumber + ’ and your race is at 11 am.’);
} else if(runnersAge <18) {
console.log(‘You’re race number is ’ + raceNumber + ’ and your race is at 12:30 pm.’);
} else(runnersAge = 18) {
console.log(‘Please see the registration desk.’);
}

This is the link to the project : https://www.codecademy.com/courses/introduction-to-javascript/projects/race-day

This is the error code I keep getting:
/home/ccuser/workspace/learn-javascript-U2P2/main.js:10
} else(runnersAge = 18) {
^
SyntaxError: Unexpected token {
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)

Thank you!

else has no condition, only a code block…

else {
    runnersAge = 18
}

That worked! Thank you!

1 Like