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});
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 }