Need the last matching item in an array? π
`findLast()` and `findLastIndex()` search from the end, no more reversing arrays just to find the last match.
const lastActive = users.findLast(u => u.active);
Learn more π
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findLast
MDN Web Docs
@mdn@mastodon.social
The official MDN Web Docs account. We deliver the best web docs around. Visit β https://mdn.dev Contribute β https://mdn.dev/community
mastodon.social
MDN Web Docs
@mdn@mastodon.social
The official MDN Web Docs account. We deliver the best web docs around. Visit β https://mdn.dev Contribute β https://mdn.dev/community
mastodon.social
@mdn@mastodon.social
Β·
Mar 12, 2026
8
0
4
Loading comments...