Skip to main content

Matt Smith

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

Modern async iteration in JavaScript with Array.fromAsync()

2 min read

Front-end work involves a lot of asynchronous data: API responses, streams, lazy-loaded content. JavaScript has long had tools for async logic, but working with async iterables has often meant verbose, manual handling. Array.fromAsync() is a newer addition that turns async data sources into arrays, and it works with async/await the...

  • JavaScript

Default parameters: your code just got smarter

2 min read

Optional function arguments come up constantly, whether it’s UI components, API calls, or utility functions. The old way was an if statement or a logical OR to set a default, and that can lead to subtle bugs. How often have you written code like this? function greet(name) { name =...

  • JavaScript
  • React

Using await at the top level in ES modules

2 min read

Writing asynchronous code in JavaScript used to come with a limitation: the await keyword could only be used inside an async function. That changed when ES2022 introduced top-level await, which lets you use await at the top of an ES module. What’s top-level await? Traditionally await was only valid inside...

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