generate functionThu, 10 Nov 2022

strip only host from url and check if exists in array $arr

url = 'http://www.google.com'; arr = ["google.com", "yahoo.com"]; return arr.includes(url.replace(/^(https?:\/\/)?(www\.)?/i, "").split('/')[0])

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant