Codecademy Javascript Projects

I spend about an hour on each of these javascript projects never getting it to run. This time I am almost certain its codecademy not reading my script correctly. Please review my script and tell me what on earth I could be missing for it not to run, about to give up I can’t get any projects to run. This particular one it wont generate the racenumber.

let raceNumber = Math.floor(Math.random() * 1000);
let registeredEarly = true;
let age = 30;

if (age > 18 && registeredEarly) {
raceNumber += 1000;
if (age > 18 && registeredEarly) {
console.log(Your race starts at 9:30am, and your race number is ${raceNumber}.); } else if (age > 18 && registeredEarly{ console.log(Your race starts at 11:00am, and your race number is ${raceNumber}.);
} else (age < 18) {
console.log(`Your race starts at 12:30pm, and your race number is ${raceNumber}. );
else{console.log(‘Please approach the registration desk, thanks!’)}

Any reason why this is tested twice?

Should that be an else if?

Yup. As mtf pointed out, testing for the same set of conditions twice is going to throw up a conflict I imagine. You’re also missing some backticks ` in your template literal strings.

Not necessarily a conflict, just the question, ‘why wasn’t this handled, already?’

1 Like

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