A First Splash into JavaScript

Build your first JavaScript program: a number guessing game!

1
2
3
Welcome to Programming!

🎯 What We're Building

We're going to create a "Guess the Number" game! The computer will think of a random number between 1 and 100, and you'll try to guess it in 10 attempts or fewer. After each guess, we'll tell you if you need to go higher or lower.

🧠 Thinking Like a Programmer

One of the hardest things to learn in programming isn't the syntax—it's learning how to break down problems into smaller, manageable pieces that a computer can understand.

📚 Learning Objectives

  • Experience what writing JavaScript feels like
  • Learn to think like a programmer
  • Understand variables, functions, and conditionals
  • See how JavaScript interacts with HTML
Number Guessing Game

Number Guessing Game

I've selected a random number between 1 and 100. Can you guess it in 10 turns or fewer?

Attempts: 0/10Remaining: 10
🔍 How It Works
Variables

Store the random number, guesses, and game state

Functions

Process each guess and update the game

Conditionals

Check if guess is correct, too high, or too low

Events

Respond to button clicks and keyboard input