Let’s say that you want to only get the origin of a URL, or maybe the host, or even protocol, how would you do this?
The URL object
URL object, which allows you to instantiate it with a string, and optionally a base to work from.
new URL(url, [base])
By using this object, you can achieve all of this very easily.
Notice all the useful object keys we can now easily refer to,