-
Notifications
You must be signed in to change notification settings - Fork 0
/
conditionals.js
67 lines (59 loc) · 1.38 KB
/
conditionals.js
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
let num = Math.random()
if(num > .5){
console.log("Heads")
} else {
console.log("Tails")
}
hour = 13
if (hour < 12){
console.log("Good morning")
} else {
console.log("Good afternoon")
}
ph = 13
if (ph > 7){
console.log("Basic")
} else if(ph < 7){
console.log("Acidic")
} else {
console.log("Neutral")
}
Math.floor(Math.random() * 10)
console.log("")
console.log("Question: ")
console.log("Answer: ")
answer = Math.floor(Math.random())
if (answer === 1){
console.log("Yes - definitely")
} else if( answer == 2){
console.log("It is decidedly so")
} else if( answer == 3){
console.log("Without a doubt.")
} else if( answer == 4){
console.log("Reply hazy, try again.")
} else if( answer == 5){
console.log("Ask again later.")
} else if( answer == 6){
console.log("Better not tell you now")
} else if( answer == 7){
console.log("My sources say no")
} else if( answer == 8){
console.log("Outlook not so good")
} else{
console.log("Very doubtful")
}
console.log("")
aqi = 33
if (aqi > 0 && aqi < 50){
console.log("Good")
} else if (aqi > 51 && aqi < 100){
console.log("Moderate")
} else if (aqi > 101 && aqi < 150){
console.log("Unhealthy (Sensitive Groups)")
} else if (aqi > 151 && aqi < 200){
console.log("Unhealthy")
} else if(aqi > 201 && aqi < 300){
console.log("Very Unhealthy")
} else {
console.log("Hazardous")
}