Skip to main content
method URL.toString
URL.toString(): string

The toString() method of the URL interface returns a string containing the complete URL.

Examples

Example 1

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

Return Type

string

See

Back to top