small js optimisation