Finding Elements Efficiently with JavaScript's findIndex