Latest Posts

I write about front-end web development. I'm inspired by Nathan Barry's motto, teach everything you know. I also take a lot of inspiration from my friend and mentor, Chris Ferdinandi.

Named access on the window object

Imagine an HTML element with the ID #app. You might be used to selecting said element with the querySelector() or getElementById() methods. But did you know that it’s possible to access the element as a property of the window object—like, or just app? Yeah, this is cool and everything, but I’m here to talk you out of it.

How to check if an object has at least one property in JavaScript

In JavaScript, we can check if an array has at least one element by checking its length property. But object literals don’t have a length property, so how can we check if they have at least one property?

An addClass() helper function

In my last post, I wrote about the instanceof operator in JavaScript. Today, we’re going to look at a recent use case I found for this operator.