Get URL without parameters in JavaScript

To get the URL of the current page until the first bar / after the domain:

javascript
let url = `${location.protocol}//${location.host}`; // https://erikmartinjordan.com

Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.