forked from iDTech-Neha/iDTech_JavaScript_Coding
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfortune_teller.js
More file actions
22 lines (19 loc) · 994 Bytes
/
fortune_teller.js
File metadata and controls
22 lines (19 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// TODO: Create a variable called "fortune" and assign a number between 0 - 10.
// YOUR CODE GOES HERE
// TODO: Create a fortune teller game using conditional statements and comparison operators.
// Conditions
// 1. If fortune is greater than or equal to 0 and less than or equal to 3, then you have a low fortune.
// 2. If fortune is greater than 3 and less than or equal to 7, then you have an average fortune.
// 3. If fortune is greater than 7 and less than or equal to 10, then you have a good fortune.
// 4. If the fortune is out of range, then the fortune can't be read correctly.
// YOUR CODE GOES HERE
var fortune = 11;
if(fortune >= 0 && fortune <= 3){
console.log("Oh no! You selected a low fortune!");
}else if (fortune > 3 && fortune <=7) {
console.log("You selected an average fortune.");
}else if(fortune > 7 && fortune <= 10) {
console.log("Congratulations! You selected great fortune.");
}
else
console.log("It hard to determine your fortune, try again!");