forked from codetapacademy/js-playground
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtime-to-race.js
More file actions
26 lines (24 loc) · 702 Bytes
/
time-to-race.js
File metadata and controls
26 lines (24 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// There is 3 variables + if else, else if statements and Logical operators.
let raceNumber = Math.floor(Math.random() * 1000);
let early = true;
let age = 18;
if(early && age > 18) {
raceNumber += 1000;
}
if(early && age > 18){
console.log(`Today the first race will start at 9:30 am, and your race number is: ${raceNumber}.`);
}
else if(!early && age > 18) {
console.log(`The second race will start at 11:00 am, and your race number is: ${raceNumber}.`)
}
else if(age < 18) {
console.log(`If you are under 18 will be only one race at 12:30pm and your race number is: ${raceNumber}.`);
}
else {
console.log('Check the registration desk');
}
export {
raceNumber,
early,
age
}