-
Notifications
You must be signed in to change notification settings - Fork 0
/
agechecker
26 lines (24 loc) · 969 Bytes
/
agechecker
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
//Create a conditonal that checks their age
//If under 16, tell them they can not drive
//If under 18, tell them they can't hate from outside the club, because they can't even get in
//If under 21, tell them they can not drink
//If under 25, tell them they can not rent cars affordably
//If under 30, tell them they can not rent fancy cars affordably
//If under over 30, tell them there is nothing left to look forward too
//On click of the h1
//Take the value from the input
document.querySelector('h1').addEventListener('click', checkAge)
function checkAge(){
let age = Number(document.querySelector('input').value)
if ( age < 16){
console.log('You cannot drive')
} else if (age < 18) {
console.log('you can\'t hate from outside the club')
} else if (age < 21) {
console.log('you can\'t drink')
} else if (age < 25) {
console.log('you cannot rent cars affordably')
} else {
console.log('There is no other milestone to look forward to.')
}
}