-
Notifications
You must be signed in to change notification settings - Fork 0
/
10.js
27 lines (25 loc) · 876 Bytes
/
10.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
// random value generated
var y = Math.floor(Math.random() * 10 + 1);
// counting the number of guesses
// made for correct Guess
var guess = 1;
document.getElementById("submitguess").onclick = function () {
// number guessed by user
var x = document.getElementById("guessField").value;
if (x == y) {
alert(
"CONGRATULATIONS!!! YOU GUESSED IT RIGHT IN " + guess + " GUESS "
);
window.location.href = "6512bd43d9caa6e02c990b0a82652dca";
} else if (x > y) {
alert("OOPS SORRY!! TRY A SMALLER NUMBER");
} else {
alert("OOPS SORRY!! TRY A GREATER NUMBER");
}
document.getElementById("guessField").value = "";
guess++;
guessDisplay.innerText = guess;
};
document.addEventListener("contextmenu", function (e) {
e.preventDefault();
});