-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
37 lines (34 loc) · 1.02 KB
/
App.js
File metadata and controls
37 lines (34 loc) · 1.02 KB
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
// let guess = prompt("Enter your range of guessing");
// while(true){
// if(guess == "quit"){
// console.log("Your are quitting the game...");
// break;
// }
// if(Math.floor(Math.random() * guess) == guess){
// console.log("You entered the correct guess...");
// break;
// }
// else{
// console.log("Enter correct guess number");
// }
// }
const max = prompt("Enter the max number");
const random =Math.floor(Math.random() * max ) +1;
let guess = prompt("guess the number");
while(true){
if(guess == "quit"){
console.log("Your are quitting the game");
break;
}
if(guess == random){
console.log("Congrats! You entered corret guess");
break;
} else if(guess < random ){
guess = prompt("hint!! Your guess was too small plz try agian");
} else if(guess > random){
guess = prompt("hint!! Your guess was too large plz try again");
}
else{
guess = prompt("Your Prompt was wrong, plz try again");
}
}