This program should be in JavaScript.
Question 3 (20 points Saved)
Write a program that plays the "Guess the Number" game with the user. The game rules and steps are as follows:
1. The program first asks the user to think of a number in the range [1, 100].
2. The program then asks the user to confirm if they are ready to start the game. If the user does not confirm, the program goes to Step 1. Otherwise, the program goes to Step 3.
3. The program initializes two variables, namely "low" and "high", with the values of 1 and 100, respectively.
4. The program calculates the guessed number, gas: low + high / 2, if low + high is even. Otherwise, it calculates low + high - 1 / 2.
5. The program shows the guessed number to the user and asks the user to enter one of the following values with the specified meanings, and flows to Step 6:
- Showing that the guessed number is greater than the number that the user picked.
- Showing that the guessed number is less than the number that the user picked.
- Showing that the guessed number is equal to the number that the user picked.
- Otherwise, if the user enters "g", the program sets low to g1 and goes to Step 4.
- Otherwise, if the user enters "t", the program terminates.
- If the user enters any other character, the program displays an error message and goes to Step 5.
As the above steps show, once the game starts, it will continue until the program can guess the number that the user picked.