1var userNumber =10;
2var counter = 0;
3var maxTries = 5;
4var randomNumber = Math.floor(Math.random() * userNumber + 1);
5while (attempts != randomNumber){
6 var attempts = prompt("Please pick a number between 1 and " + userNumber);
7 counter += 1;
8 if (counter > maxTries){
9 document.write("You have no more tries left. Press F5 to play again");
10 break
11 }
12 if (attempts == randomNumber){
13 document.write("Congrates you guess the correct number");
14 document.write(" the random number was " + randomNumber);
15 document.write(" It took you " + counter + " attempts to guess the correct number")
16 }
17}