Skip to main content

Matt Smith

  • About
  • Elsewhere
Modern Web Engineering, Front-End First

Stop using .reverse().find(): meet findLast()

2 min read

If you’ve ever needed to search an array from the end, you’ve probably used .slice().reverse().find(...), or looped backward manually. It works, but it’s clunky. We now have a better way: Array.prototype.findLast() and Array.prototype.findLastIndex(). They search from the end without reversing anything. The problem with reversing arrays Working with lists in...

  • JavaScript
  • React

Finally, safe array methods in JavaScript

2 min read

Many developers pause before using .sort(), .reverse(), or .splice() for a good reason: they mutate the original array. That one side effect causes subtle, hard-to-trace bugs, especially with shared or reactive state. The good news is that we now have non-mutating versions: toSorted() toReversed() toSpliced() They return copies instead of...

  • JavaScript
  • React

Understanding Promise.any(): when one success is enough

2 min read

If you’ve used Promise.all() or Promise.race(), you know the patterns. But sometimes you only care about the first successful result and want failures ignored. That’s what Promise.any() does: it fulfills with the first resolved promise and ignores any that reject (unless all reject). How it works Promise.any(iterable) Takes an iterable...

  • JavaScript
Older posts Newer posts
GitHub
LinkedIn
CodePen
RSS
© 2026 Matt Smith. All rights reserved.