The URL API is just fantastic for manipulating URLs. You create a new URL object by calling `new URL(urlString)`. You can you it to parse query strings as well as hashtags. On top, you can easily get the protocol (http or https). It usually makes more sense to you this API than knock up your own RegExp tests. As well as all that, you can try creating a URL object if you are not sure if the input will be a pathname or a full URL. It will only work successfully on the complete URL, so another time saving trick.