JavaScriptjavascript如何替换string中的字符串 使用replaceAll替换所有字符串,例如 let result = "1 abc 2 abc 3".replaceAll("abc", "xyz"); // `result` is "1 xyz 2 xyz 3" 或者使用正则 var find = 'abc'; var re = new RegExp(find, 'g'); str = str……继续阅读 » 1个月前 (01-26) 31浏览 0评论 0个赞