-
-
Save codecademydev/8dd1cb546469ad6ac374988fd6de4b6a to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Race number generation (rN) | |
let raceNumber = Math.floor(Math.random() * 1000); | |
// Registration early or late (rE) | |
const registeredEarly = true; | |
// Age of runner (rA) | |
const runnersAge = 22; | |
// Control and verification of rE & rA = rN | |
if (registeredEarly && runnersAge > 18) { | |
raceNumber += 1000; | |
} | |
// Assignment of rN and time slot | |
// Early Adults | |
if (runnersAge > 18 && registeredEarly) { | |
console.log(`Your race will begin early, at 09:30. Your assigned race number is ${raceNumber}. Good luck!`); | |
} // Late Adults | |
else if (runnersAge > 18 && !registeredEarly) { | |
console.log(`Your race will begin late, at 11:00. Your assigned race number is ${raceNumber}. Good luck!`); | |
} // Youth race | |
else if (runnersAge < 18) { | |
console.log(`Your race will begin at 12:30. Your assigned race race number is ${raceNumber}.`); | |
} | |
else { // Failure of assignment | |
console.log('Please report to the registration desk for assignment of race number and time slot.'); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment