Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created August 12, 2020 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/42815517c8a690eaa51457a821a5c519 to your computer and use it in GitHub Desktop.
Save codecademydev/42815517c8a690eaa51457a821a5c519 to your computer and use it in GitHub Desktop.
Codecademy export
/*let raceNumber = Math.floor(Math.random() * 1000);*/
let raceNumber ;
let earlyRegistration = Math.floor(Math.random()*2);
let runnerAge = Math.floor(Math.random()*100+1);
let Adult;
if (earlyRegistration === 1 && runnerAge > 18){
Adult = true ;
raceNumber = Math.floor(Math.random() * 1000);
console.log(`Number ${raceNumber} your race starts at 9:30 AM!`);
} else if (earlyRegistration === 0 && runnerAge > 18) {
Adult = true ;
raceNumber = Math.floor(Math.random() * 1000 + 1000);
console.log(`Number ${raceNumber} you are late and your race starts at 11:00 AM`);
} else if (runnerAge < 18 ){
Adult = false ;
raceNumber = Math.floor(Math.random() * 1000);
console.log(`Youngster your number is ${raceNumber} and your race starts at 12:30 AM`);
} else {
console.log(`You should see the registration desk`)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment