Changing javascript syntax