js - 各浏览器不兼容方法 replaceAll 解决

在脚本最顶上定义该方法

String.prototype.replaceAll = function(s1,s2){
return this.replace(new RegExp(s1,"gm"),s2);
}

 

posted @ 2022-03-11 12:33  岑惜  阅读(845)  评论(0)    收藏  举报