Here's a step-by-step guide to building a game from scratch in JavaScript. Play it! Be sure to View Source!