showing results for - "object javascript match by property value"
Mariella
20 Jan 2019
1// MDN Ref:
2// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
3
4var result = jsObjects.find(obj => {
5  return obj.b === 6
6});
Emily
17 Jan 2018
1var result = jsObjects.find(obj => {
2  return obj.b === 6
3})
Nico
28 Aug 2016
1const inventory = [
2  {name: 'apples', quantity: 2},
3  {name: 'bananas', quantity: 0},
4  {name: 'cherries', quantity: 5}
5];
6
7function isCherries(fruit) { 
8  return fruit.name === 'cherries';
9}
10
11console.log(inventory.find(isCherries)); 
12// { name: 'cherries', quantity: 5 }
similar questions
queries leading to this page
object javascript match by property value