Skip to content

Instantly share code, notes, and snippets.

@zokis
Created July 16, 2012 19:17
Show Gist options
  • Save zokis/3124471 to your computer and use it in GitHub Desktop.
Save zokis/3124471 to your computer and use it in GitHub Desktop.
replaceAll, replace em js com mesmo comportamento do python
String.prototype.replaceAll = function(s1, s2){
var s = this;
while (s.indexOf(s1) > -1){
s = s.replace(s1, s2);
}
return s;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment