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.

The simplest way to check the

I’ve written a couple of posts recently about event delegation and guard clauses. There are many ways you can check the when using event delegation: by its ID, by its classes, by its tag name, by its attributes, and more. But the easiest way is to use the matches() method.

Guard clauses in JavaScript

When using event delegation, you need to make sure the element that fired the event is the one you wanted. This commonly involves wrapping your event handler within a conditional statement. Guard clauses are a way to make this process much cleaner.

Three ways to write a JavaScript function

In JavaScript, there are three ways to write a function. We have function declarations, function expressions, and arrow function expressions. Which should you use? What’s the difference? So many questions! 🤯