break out of for each loop javascript