To use Lodash to find and return an object from a JavaScript array, we use the find
method.
For instance, we write
const song = _.find(songs, { id });
to call find
with songs
with { id }
to find the object in the songs
array with id
property equal to id
.