原型链实现js的replaceAll

String.prototype.replaceAll = function(reallyDo,replaceWith,ignoreCase){
if(!RegExp.prototype.isPrototypeOf(reallyDo)){
return this.replace(new RegExp(reallyDo,(ignoreCase ?
"gi":'g')),replaceWith);
}else{
return this.replace(reallyDo,replaceWith);
}
}

你可能感兴趣的:(原型链实现js的replaceAll)