Lately Loading JavaScript

You want to load your JavaScript code as late as possible in the downloading of the site—that is just before the closing body tag. If you load it earlier, such as in the head element, it can block the download of other assets (like zombies blocking a doorway with their bodies after you smack them... Read More

When 2 + 2 is actually 22

A common place where JavaScript’s internal typing system happens is when you try to add a number (2) and a string that looks like a number (“2”). In JavaScript, 2 + “2” is “22”. Since one of these is a string, it casts/treats the other as a string too and puts them together or concatenates them.... Read More

Two Kinds of Web Components

There are two kinds of web components: autonomous (name your own element) and customized built in elements (supercharge an existing element). Note: Safari does not support customized built in elements, but all other browsers do. Custom elements require a dash in their name and some JavaScript. Custom built in elements need the is attribute and... Read More