Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[js replaceAll 实现] #js
String.prototype.replaceAll = function(search, replacement) {
var target = this;
return target.replace(new RegExp(search, 'g'), replacement);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment