property URL.port
The port
property of the URL interface is a string that represents the port of the URL if an explicit port has been specified in the URL.
Examples #
#
const myURL = new URL('https://example.org:8080/foo');
console.log(myURL.port); // Logs "8080"
const myOtherURL = new URL('https://example.org/foo');
console.log(myOtherURL.port); // Logs ""
Type #
string