break out of if else javascript