I have a string in javascript that is a url.
Example
https://www.example.local/cars/bmw/12312?exp=2
I want to extract just the domain, no matter what the url path is. For example, all I want is
https://www.example.local
no matter what the url paths / query params are.
How would I do this.