First Javascript App from scratch- Hangman

In an effort to get out of tutorial hell, I wrote an app from scratch. I just wanted to throw something together to prove to myself that I could. It’s classic Hangman with Game of Thrones words.

I’d love some feedback on the code.

I don’t know what it is about codepen, but I always seem to have trouble with it working correctly when I’m on my work computer(which runs on Vista…) In codepen, the refresh button is not working. But when I host the code directly, its fine.

Codepen:
https://codepen.io/ThomasAurelius/pen/QRdGKP?editors=1000

Hosted:
http://thomasaurelius.com/projects/hangmanV4.html

and for non GoT fans… here’s the wordlist:

var wordlist = ["RIVERRUN", "THRONE", "NIGHTKING", "LANNISTER", "SUMMER", "MEREEN", "WINTER", "SANDOR", "CERSEI", "DROGON", "BAELISH", "WILDLINGS", "DRAGON", "CHILDREN", "WESTEROS", "SCORPION", "GREYJOY", "TYRELL"]; 
2 Likes

Nice job.

Some improvements you could include might be allowing for keyboard input rather than the onscreen keyboard. I’d consider recording whether someone has seen the initial alert before as well, since it gets annoying on subsequent plays. You could do that with a cookie or local storage most likely, which are two more browser apis worth getting familiar with :slight_smile:

I like your app!

I have been having a similar reload issue with one that I recently put on CodePen. I’m not sure why it behaves differently there.

The only thing that jumps out at me that I would consider changing is the cursor when you hover over your .letterbox items but that really comes down to personal preference.

Thanks for sharing your work!

Thanks for the feed back!
Those are good ideas.

When I first built it, I did keyboard, but I had trouble getting both kb and mouse click to work, so I scrapped kb. I’ll work on adding it back.