property URL.host
The host
property of the URL interface is a string that includes the URL.hostname
and the URL.port
if one is specified in the URL includes by including a :
followed by the port number.
Examples #
#
const myURL = new URL('https://example.org/foo');
console.log(myURL.host); // Logs "example.org"
const myOtherURL = new URL('https://example.org:8080/foo');
console.log(myOtherURL.host); // Logs "example.org:8080"
Type #
string