deno.com
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 #

#

Example 1

const myURL = new URL('https://example.org:8080/foo');
console.log(myURL.port);  // Logs "8080"
#

Example 2

const myURL = new URL('https://example.org/foo');
console.log(myURL.port);  // Logs ""

Type #

string

See #