URL: toString() method
The toString() method of the URL interface returns a string containing the whole URL, which is the same value as URL.href.
Syntax
toString()
Parameters
None.
Return value
A string.
Examples
const url = new URL(
"https://developer.mozilla.org/en-US/docs/Web/API/URL/toString",
);
url.toString(); // should return the URL as a string
Specifications
Browser compatibility
See also
- The URL interface it belongs to.
这篇文档对你有帮助吗?
谢谢你的反馈!