Skip to content

Instantly share code, notes, and snippets.

@hacksoldier
Last active September 29, 2015 12:10
Show Gist options
  • Select an option

  • Save hacksoldier/4b0ba79d15eb54ca69a5 to your computer and use it in GitHub Desktop.

Select an option

Save hacksoldier/4b0ba79d15eb54ca69a5 to your computer and use it in GitHub Desktop.
This function is a replaceAll(). Once inserted you can safely do var str = str.replaceAll(); - JavaScript
String.prototype.replaceAll = function (find, replace) {
var str = this;
return str.replace(new RegExp(find, 'g'), replace);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment