Skip to content

Instantly share code, notes, and snippets.

@konfou
Forked from vielhuber/script.js
Last active October 25, 2017 11:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save konfou/3dfa46afb0b4456cf56780f2ae4c75c5 to your computer and use it in GitHub Desktop.
Save konfou/3dfa46afb0b4456cf56780f2ae4c75c5 to your computer and use it in GitHub Desktop.
replace all occurences in a string without regex #js
String.prototype.replaceAll = function(foo, bar) {
return this.split(foo).join(bar);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment