Skip to main content

Matt Smith

  • About
  • Contact
Web Dev | Front-End Engineer | UX Designer

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

2 min read
4047 views

If you’ve ever needed to search an array from the end, you’ve probably reached for a combination of .slice().reverse().find(...), or looped backward manually. It works, but it’s not an elegant solution. We now have a better way: Array.prototype.findLast() and Array.prototype.findLastIndex(). These features let you search arrays from the end without...

  • JavaScript
  • React

Finally, safe array methods in JavaScript

2 min read
6564 views

There’s a good reason that many developers pause before using .sort(), .reverse(), or .splice() in JavaScript: those methods mutate the original array. That single side effect can lead to subtle, hard-to-trace bugs, especially in apps with shared or reactive state. The good news is that in the last couple of...

  • JavaScript
  • React

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

2 min read
1426 views

Promises have long been our go-to when working with asynchronous code in JavaScript. If you’ve used Promise.all() or Promise.race() to coordinate async operations, you know the patterns. But what if you’re only interested in the first successful result, ignoring failures? That’s exactly what Promise.any() does: it fulfills with the first...

  • JavaScript
Older posts Newer posts
Twitter
LinkedIn
GitHub
CodePen
© 2025 Matt Smith. All rights reserved.