Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let raceNumber = Math.floor(Math.random() * 1000);
- // Initializing the 2 variables of the problem
- let earlyRegistered = true;
- let runnerAge = 20;
- // Conditionals, changing the raceNumber variable
- if(runnerAge > 18 && earlyRegistered === true){
- raceNumber += 1000;
- }
- // Conditionals
- if(runnerAge > 18 && earlyRegistered === true){
- console.log(`Participant No ${raceNumber} will run at 9:30 am.`);
- }
- else if(runnerAge > 18 && earlyRegistered === false){
- console.log("Late adults will run at 11:00 am.")
- }
- else if(runnerAge < 18){
- console.log(`Participant No ${runnerAge} will run at 12:30 am.`);
- }
- // Else-case, when runnerAge = 18 EXACTLY
- else{
- console.log("You are exactly 18 years old, so you have to check the registration desk.");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement