node js find element or code example
Example 1: 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);
Example 2: find a single element in array of objects javascript
myArray.find(x => x.id === '45').foo;