Skip to main content

Matt Smith

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

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

Logical assignment operators in JavaScript: small syntax, big wins

2 min read

In day-to-day JavaScript, we often check a variable before assigning it a new value, and it gets repetitive with component props, global configs, and state objects. Logical assignment operators (ES2021) shorten that without changing the logic. What are logical assignment operators? Logical assignment operators combine a logical operator (||, &&,...

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