-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path26_Magic_8_Ball.js
More file actions
51 lines (36 loc) · 818 Bytes
/
26_Magic_8_Ball.js
File metadata and controls
51 lines (36 loc) · 818 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
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
// Write code below 💖
const question = "Put question string here";
const randomNumber = Math.floor(Math.random() * 9) + 1
let answer = " ";
if (randomNumber === 1){
answer = 'Yes - definitely.';
}
else if (randomNumber === 2) {
answer = 'It is decidedly so.';
}
else if (randomNumber === 3){
answer = 'Without a doubt.';
}
else if (randomNumber === 4){
answer = 'Reply hazy, try again.';
}
else if (randomNumber === 5){
answer = 'Ask again later.';
}
else if (randomNumber === 6){
answer = 'Better not tell you now.';
}
else if (randomNumber === 7){
answer = 'My sources say no.';
}
else if (randomNumber === 8){
answer = 'Outlook not so good.';
}
else if (randomNumber === 9){
answer = 'Very doubtful.';
}
else {
answer = 'Error';
}
console.log(question);
console.log(answer);