Preview:
//The find() method returns the value of the element of an array
//that FIRST fulfils the condition of a provided test function. Otherwise, undefined is returned.


const arr = [1,3,5,7,9]
//undefined

arr.find(el => el ===5)
//5

arr.find(el => el > 4)
//5

const peopleArray = [{id:1}, {id:4}, {id:7}]
//undefined

peopleArray.find(persom => person.id ===4)
//{id:4}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter