jsObjects.find(x => x.b === 6)
From MDN:
The find() method returns a value in the array, if an element in the array satisfies the provided testing function. Otherwise undefined
is returned.
Side note: methods like find()
and arrow functions are not supported by older browsers (like IE), so if you want to support these browsers, you should transpile your code using Babel.