find a single element in array of objects javascript

JavaScript
// To find a specific object in an array of objects
myObj = myArrayOfObjects.find(obj => obj.prop === 'something'); var ages = [3, 10, 18, 20];

function checkAdult(age) {
  return age >= 18;
}

function myFunction() {

    document.getElementById("demo").innerHTML = ages.find(checkAdult);
} myArray.find(x => x.id === '45').foo;
Source

Also in JavaScript: