Skip to main content

Matt Smith

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

When to use map() vs. forEach()

1 min read

I saw this post on Reddit about a JavaScript coding assessment and it got me thinking about map() and forEach(). They look similar, but they do different jobs. Here’s how I think about it, and why I usually go with map() when I’m transforming data. What’s map()? The map() method...

  • JavaScript

Mastering default values in JavaScript with the nullish coalescing (??) operator

1 min read

One piece of JavaScript syntax I’ve come to appreciate is the nullish coalescing (??) operator. It’s easy to overlook until it saves you from a subtle bug. If you’re still using the logical OR (||) operator to provide default values, it’s worth knowing where the two behave differently. What each...

  • JavaScript

Leveraging “unknown” instead of “any”

1 min read

One habit I’ve picked up over the years is using unknown as a default before any. I still use any occasionally, but I’ve become much more intentional about it. The reason is pretty simple: any opts you out of TypeScript’s type checking. That can be convenient when you’re prototyping or...

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