Javascript String replaceArrayLit(find, replace)

Description

Javascript String replaceArrayLit(find, replace)


String.prototype.replaceArrayLit = function(find, replace) {
    var replaceString = this;
        for (var i = 0; i < find.length; i++) {
          replaceString = replaceString.split(find[i]).join(replace[i]);
        }//from  w  w  w  .j  ava2s  .  c  om
    return replaceString;
};



PreviousNext

Related