JS - 给String.prototype添加replaceAll方法
String.prototype.replaceAll = function (targetStr, newStr) {
var sourceStr = this.valueOf();
while (sourceStr.indexOf(targetStr) !== -1) {
sourceStr = sourceStr.replace(targetStr, newStr);
}
return sourceStr;
};


浙公网安备 33010602011771号