If I understand correctly, you want to check the current domain (eg. w3schools) against api.w3schools and www.youtube, and return true for the first and false for the second (or the other way around)
Then technically it’s possible without string splitting:
If I understand correctly, you want to check the current domain (eg. w3schools) against api.w3schools and www.youtube, and return true for the first and false for the second (or the other way around)
Then technically it’s possible without string splitting:
const href = 'retrieved-from-the-anchor-element'; (new URL(href, location.href).hostname).endsWith(location.hostname)Well, the whole web is basically “let’s go, make it work somehow”. Thanks for your effort!