CHAPTER 9
Code Explanation
for (j=0;j<alphabet.length;j++) { Iterates over all of the letters in the alphabet
uniqueid = "a"+String(j); Constructs the unique identifier
thingelem = document.getElementById
(uniqueid);
Gets the element
thingelem.removeEventListener('click',
pickelement,false);
Removes the event handling for this element
} Closes the j iteration
} Closes the cur test to determine if the
hanging is complete
} Closes the if (not) test (bad guess by
player)
var id = this.id; Extracts the identifier for this element
document.getElementById(id).style.display
= "none";
Makes this particular alphabet button
disappear
} Closes the function
Closes the script
Closes the head
Opening tag that sets up call to init
Hangman
Puts the name of game in big letters Opening tag for paragraph
Closing tag for canvas