HTML and CSS Reference
The “Guess The Letter” Game Variables
in canvasApp() , so they have scope to the encapsulated functions that we define locally:
ber, the better he has done in the game.
The content of this variable is displayed to give the user instructions on how to play.
choose asecret letter forthe game andtofigure outthe relative position ofthe letter inthe
Thisvariable holdsthecurrentdate.Itisdisplayed onthescreenbuthasnootherpurpose.
This variable holds the current game's secret letter that needs to be guessed.
instruction. If the letter is closer to “z,” we give the “Higher” instruction.
This array holds the current set of letters that the player has guessed already. We will print
this list on the screen to help the player remember what letters he has already chosen.
This variable is set to false until the player wins. We will use this to know when to put
the “You Win” message on the screen and to keep the player from guessing after he has
Here is the code: