Example 1 — Match One Property
Return the first object whose field matches a single key-value pair.
var items = [
{ name: "Apple", type: "fruit" },
{ name: "Carrot", type: "veg" },
{ name: "Mango", type: "fruit" }
];
_.findWhere(items, { type: "fruit" });
// → { name: "Apple", type: "fruit" } How It Works
- List. Three objects; two are fruits.
- Matcher.
{ type: "fruit" }requires that one field. - First hit. Apple matches at the start → return it.
- Stop early. Mango is never checked.

