Regroup repeated javascript variable declarations

It's just a minor stylistic thing, but where we have multiple variable
declarations one-after-another, we now group them to use only one `var`
keywords, and delimit with commas.