Here is a link to a great HTML 5 game creation tutorial. Even if you are not a game creator there are still some Javascript object creating techniques that I think are worth looking at.
http://blog.sklambert.com/html5-canvas-game-html5-audio-and-finishing-touches/
The link is to the final tutorial in the five part series, but I would suggest starting from the first part and walking through the code through till the last part.