How to detect if URL() constructor is supported by browsers?

Viewed 1613

I want to detect if a browser support the URL() constructor.

I want to use it like this:

const url = new URL(urlString, [baseURLstring])

I can't find a proper method to check if it's supported by browser?

2 Answers
Related