Skip to content

Lesson 4 of 4 · 8 min

Build a guessing game

Math.random() gives a random number. We use it to pick a secret number between 1 and 10.

The player guesses and the page gives hints. You have just built a real game!

Your turn: Change the game to choose a number between 1 and 50.

Code editor

Live preview