Parses a URL string into a URL object. Returns null if the URL is invalid.
URL
null
The URL string to parse.
parseUrl("https://example.com/path?q=1")?.pathname // => "/path"parseUrl("not-a-url") // => null Copy
parseUrl("https://example.com/path?q=1")?.pathname // => "/path"parseUrl("not-a-url") // => null
Parses a URL string into a
URLobject. Returnsnullif the URL is invalid.