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 last item in a JavaScript array

In JavaScript, arrays are zero-indexed. This means their indices start counting from 0 instead of 1. Imagine an array of 50 items, for example. Its indices would range from 0 to 49.

Syntax errors vs logic errors

Generally speaking, there are two kinds of error you’ll encounter while programming: syntax errors and logic errors. The former is easier to track down, while the latter tends to be more difficult!

Static vs live NodeLists

The Document.querySelectorAll() method and the Node.childNodes property both return a NodeList. But the former returns a static NodeList, while the latter returns a live NodeList. This is an important difference to understand, else your code might behave in unexpected ways.