前端Js 之封装replaceAll 云博小周宇2024年5月5日2023年8月14日1 Min Read 一、代码 String.prototype.replaceAll = function (s1, s2) { return this.replace(new RegExp(s1, ‘gm‘), s2) };