01219245/javascript1/tutorial1

จาก Theory Wiki
ไปยังการนำทาง ไปยังการค้นหา
This is part of 01219245

We will write a simple number guessing game in JavaScript. Your goal is to guess a number between 1 - 100. If you guess incorrectly, a hint is given to you: if your guess is too high or too low. The game proceeds until you guess correctly.

An example of the interaction is given below:

Round 1, your guess?
40
Too low.
Round 2, your guess?
90
Too high.
Round 3, your guess?
75
Too high.
Round 4, your guess?
55
Great that's correct.

Let's get started

First sketch

Main loop