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.

Reduce an array to a single value with vanilla JS

My friend Mark Buskbjerg and I are both members of the Vanilla JS Slack channel run by Chris Ferdinandi. Yesterday, Mark asked the channel for help with a challenging array structure. Let’s look at how I helped him come up with a solution using the really versatile Array.reduce() method!

How to manipulate an element's classes in vanilla JS

In jQuery, there are several methods that allow you to manipulate the classes on an element. These are addClass(), removeClass(), toggleClass(), and hasClass(). Let’s look at how we can do these things using vanilla JS, and also how to replace a class—a method that jQuery lacks!

Recreating jQuery's basic "effects" in vanilla JS

I’m a big fan of small, reusable helper functions. My good friend and mentor, Chris Ferdinandi, maintains a fantastic collection over at The Vanilla JS Toolkit. Today, let’s create some for jQuery’s .hide(), .show(), and .toggle() methods using vanilla JS.