const isValidURL = (url) => {
try {
new URL(url);
return true;
} catch (error) {
return false;
}
}
isValidURL('https://www.mybj123.com/qdkfnote/')
// true
isValidURL("https//invalidto");
// false
const isValidURL = (url) => {
try {
new URL(url);
return true;
} catch (error) {
return false;
}
}
isValidURL('https://www.mybj123.com/qdkfnote/')
// true
isValidURL("https//invalidto");
// false