A Console Game
Build a console-based number guessing game using Node.js. Understand how to handle user input from the console, compare guesses with random numbers, manage game state with tries, and output results using event-driven programming.
We'll cover the following...
We'll cover the following...
Coding challenge
We want to create a random number guessing game. The way it works is that the game generates a random number from 1 to 10, and the player must try to guess it in 3 tries or less.
Here’s what you will have to do:
- Generate a random number (don’t worry, we will do this for you).
- Take the player’s input from the console (don’t worry, we will do this for you as well).
- Compare the player’s guess with the generated number and check if: