If Else In Javascript Function How To Use