compiler/javascript: generate better variable declarations