This is the basis for a Defender like arcade game written in
JavaScript. You can see screen dumps of some other crazy
experiments I've done with JavaScript by looking at the
software page.
Note that this example shows how to define and use
JavaScript objects/ classes. They are more simplistic
than those available in languages like Java but can
still help to improve the structure of complex code.