Is there a way in JavaScript to check if a string is a URL?
RegExes are excluded because the URL is most likely written like stackoverflow; that is to s
stackoverflow
You can use the URL native API:
const isUrl = string => { try { return Boolean(new URL(string)); } catch(e){ return false; } }