What is the hostname?
Originally, it is the name of a computer connected to the network.
/ at the beginning of the URL.
The hostname property is a property of the Location object that has information about the current location and contains the string that contains the domain of the URL.
The syntax is below.
Since Window is optional, you can use it by writing location.hostname.
Below is a sample code to get the host name.