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.

How to get the children of an element in vanilla JS

In jQuery, there are two methods you can use to get an element’s children. The contents() method will get all child nodes including comment and text nodes. The children() method will only get children that are HTML elements. Here’s how to do this in vanilla JS with browser support back to IE9.

Array.indexOf() vs Array.includes()

The Array.indexOf() and Array.includes() methods both let you check if an item exists in an array. So, what’s the difference? When should you use one method versus the other? 🤔

How to manipulate attributes in vanilla JS

In jQuery, you can use the attr() and removeAttr() methods to manipulate an HTML element’s attributes. These methods really are redundant these days. You can do this so easily in vanilla JS with full support back to IE8.