I understand all parts of the solution except for
break;. We have previously only used
break; in switch cases, and I don’t understand why we want to break out of the loop cycle here. Couldn’t there theoretically be more matches in the array and we would want to keep looking?
Is it because once we’ve found one match in this subarray, we don’t need to keep looking because we already know we’re splicing it out? If THAT’S the answer, what ‘harm’ could come from not
break;-ing here? My answer did not pass until I had it, and I never would have solved this without coming to the forums, ha.