Array.prototype.findIndexintermediateconst words = ['apple', 'banana', 'cherry']
words.findIndex(w => w.startsWith('b')) // β 1Use findIndex() to locate the position of a string that matches a pattern.
You can use findIndex() with strings just as easily as with numbers or objects.
Challenge: Implement indexOfLong(strs, len) that returns the index of the first string with length > len.
indexOfLong(['hi', 'hello', 'world'], 4) // β 1
indexOfLong(['a', 'bb'], 5) // β -1