JSFiddle - React, Tailwind, and code Playground
by grundez
JavaScript
var things = [
{name: "house"},
{name: "table"},
{name: "egg"},
{name: "bob"},
{name: "hamster"}
];
var getBob = function(thing){
return (thing && thing.name == "bob")? thing: null;
};
// returns true not the object i want
console.log(things.some(getBob));
// returns the object but in an array and does not break when found
console.log(things.filter(getBob)[0]);