Clean up javascript snippets

No semicolons. Whitespace. Comma-first. For loops.

Signed-off-by: Tim Smart <tim@fostle.com>