用 replace,直接上代码: let str = "https://www.baidu.com"; console.log(str.replace("https://www.","")) // baidu.com