Skip to content

Latest commit

 

History

History
36 lines (29 loc) · 1.5 KB

File metadata and controls

36 lines (29 loc) · 1.5 KB

javaScript-number-guessing-game

"A fun and interactive Number Guessing Game built with JavaScript. It uses random number generation and logic to guide the user to the correct answer. 🎮"

🎯 Number Guessing Game in JavaScript

Welcome to the Number Guessing Game! This is a simple logic-based game where the computer selects a random number between 0 and 100, and the player has to guess it.

🕹️ Features

  • Random Number Generation: Uses Math.random() to generate a new challenge every time.
  • Smart Hints: Tells the user if their guess is "Too Big" or "Too Small".
  • Infinite Loop: The game continues until you find the correct number.

🛠️ How it Works

  1. The computer picks a number between 0 and 100.
  2. The user is prompted to enter a guess.
  3. If the guess is correct, the user wins! 🏆
  4. If not, the game provides a hint and asks for another guess.

🚀 How to Run

Using Browser Console:

  1. Open any web browser (Chrome, Firefox).
  2. Press F12 to open Developer Tools.
  3. Go to the Console tab.
  4. Copy and paste the code from index.js and press Enter.

Using Node.js:

Note: Since prompt() is a browser function, if you run this in Node.js/GitHub Codespaces, you will need to replace prompt with a library like prompt-sync.

📂 File Structure

  • game.js: Contains the main game logic.
  • README.md: Project documentation.

🏷️ Keywords

  • JavaScript Games
  • Logic Building in JS
  • Math.random JavaScript
  • Programming Exercises for Beginners