JavaScript style improvement