Created
October 9, 2017 13:06
-
-
Save rafaelmaeuer/4cb0279fa18bf4401ca9c73b9fa6e483 to your computer and use it in GitHub Desktop.
How to replace all occurrences of a string in JavaScript? - From https://stackoverflow.com/questions/1144783/how-to-replace-all-occurrences-of-a-string-in-javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.replaceAll = function(search, replacement) { | |
var target = this; | |
return target.split(search).join(replacement); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment