A Fun JavaScript Game I Threw Together

Perhaps you have heard of some keyboarding speed-improving websites such as 10fastfingers.com and TypeRacer, perhaps not. At any rate, my friend David Chen (follow him on Twitter – @Ninchendoz95) has been playing these games a lot, and I was inspired to create something similar. For once, I didn’t go over the top. There’s no glorious database of the most common English language words, no web service that sends the JavaScript behind the game a JSON string full of words to put in, no leaderboard, and minimalist styling on the game web page itself.

You can play my little game here.

I should warn you – there are some issues with TextRacer. It uses the KeyPress event, so words are always somehow one character behind. You can change “keypress” to “keyup” but that introduces another slew of bugs: multiple keys pushed down at once and repeated characters (from holding keys down) registering incorrectly. Luckily, TextRacer more or less works and is amusing to try out a few times.

The code is by no means production-worthy! I was attempting to build something extensible at first but then just started hard-coding the names of divs I was using into the JavaScript.

Here’s TextRacer in action:

TextRacer in action

It almost looks kind of good…

As always, I am amazed by how useful jQuery was in this whole development process. I tested TextRacer in Firefox and Chrome, and the code worked just as well in both.

Have fun tinkering!

2 thoughts on “A Fun JavaScript Game I Threw Together”

Leave a Reply

Your email address will not be published. Required fields are marked *


× one = 3

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>