JavaScript: How to get the URL parts from a URL
const url = new URL('http://example.com:12345/blog/foo/bar?startIndex=1&pageSize=10'); const { protocol, hostname, port, pathname, search } = url; console.log('protocol =>', protocol); console.log('hostname =>', hostname); console.log('port =>', por...
Jan 18, 20221 min read10
