find an element in an array based on a key javascript code example
Example 1: javascript get array object by id
myArray.find(x => x.id === '45').foo;
Example 2: find object in array by property javascript
// Find an object with a given property in an array
const desiredObject = myArray.find(element => element.prop === desiredValue);