LOYOLITE
If you're gonna shoot, shoot!, Don't talk.!
Monday, August 12, 2019
How to replace all the entries in a string in Javascript? like replaceAll?
This should do the trick by adding a new method (
replaceAll)
to the String prototype.
String.prototype.replaceAll = function(search, replacement){
return this.replace(new RegExp(search, 'g'), replacement);
};
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)