JavaScript - Function declaration change