Example 1 — Official: Author + Year
Keep plays that match both properties.
var listOfPlays = [
{ title: "Cymbeline", author: "Shakespeare", year: 1611 },
{ title: "Hamlet", author: "Shakespeare", year: 1603 },
{ title: "The Tempest", author: "Shakespeare", year: 1611 },
{ title: "Macbeth", author: "Shakespeare", year: 1606 }
];
_.where(listOfPlays, { author: "Shakespeare", year: 1611 });
// → Cymbeline, The Tempest How It Works
- Two required pairs: author and year must both match.
- Hamlet / Macbeth fail on year.
- Cymbeline / The Tempest pass both checks.
- Result is a new array — original list unchanged.

