Q:

find object in array by property javascript

var result = jsObjects.find(obj => {
  return obj.b === 6
})
2
// To find a specific object in an array of objects
myObj = myArrayOfObjects.find(obj => obj.prop === 'something');
9
const array1 = [5, 12, 8, 130, 44];

const found = array1.find(element => element > 10);

console.log(found);
// expected output: 12
6
myArray.find(x => x.id === '45').foo;
0
// Find an object with a given property in an array
const desiredObject = myArray.find(element => element.prop === desiredValue);
0

New to Communities?

Join the community