Array.prototype.findintermediateconst words = ['cat', 'elephant', 'dog']
words.find(w => w.length > 4) // β 'elephant'Use find() to retrieve the first string from an array that meets a length or content condition.
find() works with any element type. You can use it to find strings satisfying a length or content condition.
Challenge: Implement findLongest(strs) that returns the first string with more than 5 characters.
findLongest(['hi', 'hello', 'greetings']) // β 'greetings'
findLongest(['a', 'bb', 'ccc']) // β undefined