代码::

注意:原始的replace()方法只能替换第一个字符串check

String.prototype.replaceAll = function (s1, s2) {
return this.replace(new RegExp(s1, "gm"), s2);
} var data = "check out,check in";
var li = data.replaceAll('check','checked');
05-15 21:02