📜  javascript 从字符串中获取域名 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:39.606000             🧑  作者: Mango

代码示例1
const url = 'https://www.mydomain.com/blog?search=hello&world';
const domain = (new URL(url)).hostname.replace('www.','');