How to Parse URL in JavaScript

Dmitri Pavlutin wrote a short and clear article about how to parse URL in JS. Worth saving.

In this post, I’m going to show you the structure of an URL and its main components. Then, I’m going to describe how to use the URL() constructor to easily pick components of an URL like hostname, pathname, query, or hash.

Dmitri Pavlutin: How to Parse URL in JavaScript: hostname, pathname, query, hash