showing results for - "find an object from array of objects javascript"
Hannah
26 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});
Elisa
20 Jan 2016
1var result = jsObjects.find(obj => {
2  return obj.b === 6
3})
Anthony
17 Feb 2020
1function getByValue2(arr, value) {
2
3  var result  = arr.filter(function(o){return o.b == value;} );
4
5  return result? result[0] : null; // or undefined
6
7}
8
similar questions