Skip to main content

Matt Smith

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

Using await at the top level in ES modules

June 16, 2025
2 min read
2289 views

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, a modern ES module feature that enables new patterns for asynchronous code at the module level. What’s top-level await? Traditionally await...

  • JavaScript

Write more reliable JavaScript with optional chaining

June 2, 2025
2 min read
3069 views

Let me know if this sounds familiar: you’re deep into debugging or trying to access a deeply nested property in a JavaScript object. Suddenly you see this classic error: TypeError: Cannot read property 'x' of undefined This is a common pain point, especially when working with API responses, optional fields,...

  • JavaScript
  • React

How JavaScript’s at() method makes array indexing easier

May 19, 2025
2 min read
2466 views

Working with arrays in JavaScript is an everyday thing for front-end developers. We reach for arrays constantly — whether we’re rendering lists, managing state, or juggling DOM elements. But what if I told you there’s a more elegant way to access elements at a specific index — especially the last...

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