The problem with new URL(), and how URL.parse() fixes that | Kilian Valkhof
Briefly

The 'new' in front of new URL() indicates that it's used as a constructor: calling it creates a new URL instance for you. When you give it a malformed URL however, one that it can't parse, it throws an error.
URL.canParse(), a recent addition to the URL API, returns true if the URL is parseable, enabling inline error handling to improve code readability and simplicity.
Read at Kilian Valkhof | Front-end & user experience developer
[
add
]
[
|
|
]