Useful prototype function written by Patrick Woldberg of FLZone.

1
2
3
String.prototype.replace = function(pattern, replacement) {
  return this.split(pattern).join(replacement);
}