[misc] Slightly improved JS performance + codestyle