The drawPlayingField() function is responsible for redrawing the playingfield frame after each guess, as well as for drawing the initial frame. Like the displayScoreBoard() function you saw earlier, it creates a new HTML page and writes it to the playingfield frame.
However, it’s more dynamic than displayScoreBoard(): It uses the global variable score to determine how to draw the gallows and the hanged man, and it uses the guessedLetters array to determine which letters to fill in, and to display which letters the user has already guessed. While determining which letters to fill in, it also notes whether the user has guessed the word: