function isValidUrl(s) { try { new URL(s); return true; } catch(err) { return false; } }This is accepts too much:
URL.canParse(s) // NOT recommended
function isValidUrl(s) { try { new URL(s); return true; } catch(err) { return false; } }This is accepts too much:
URL.canParse(s) // NOT recommended