Sometimes, an Array.find is a sign of sloppy code


Sometimes, an Array.find is a sign of sloppy code.

Example: Code passes around an id, and then multiple spots search an array for the full record.

Solution: Need the entire object? Then pass the entire object around. Don't just pass the id. That leads to needless array lookups.

View original on X