wondering how to make a simple function that would loop through a randomly chosen word and hold all of the letters (most likely in an array) for using in a hangman game. The code below just captures the last letter.
document.onkeyup = function(event) {
var userInput = event.key;
for(var i = 0; i < word.charAt[i]; i++)
return i;