Skip to content

Instantly share code, notes, and snippets.

View frentsel's full-sized avatar

Frentsel Alexandr frentsel

  • frentsel
  • Ukraine
View GitHub Profile
@frentsel
frentsel / str_replace.js
Last active May 24, 2018 13:30
js analog PHP str_replace()
String.prototype.replaceAll = function(find, replace) {
if(typeof find === 'string')
return this.split(find).join(replace);
var str = this;
find.forEach(function(el, i){
str = str.split(el).join(replace[i]);
});