javascript: reduce initializations in generated code