We are still cooking the magic in the way!
Problem
Using filter() to find a single item processes the entire array unnecessarily.
Solution
Use Array.find() which stops at the first match, improving performance.
Benefit
Up to 100x faster for large arrays and makes intent clearer.
Code Example
const users = [{id: 1, name: 'John'}, {id: 2, name: 'Jane'}];
// Inefficient:
const user = users.filter(u => u.id === 2)[0];
// Efficient:
const user = users.find(u => u.id === 2);