Replace all String value - Node.js String

Node.js examples for String:Replace

Description

Replace all String value

Demo Code

String.prototype.replaceAll = function replaceAll(a, b){
  var s = this;//  www . ja v  a 2s .  co m
  while(s.indexOf(a) > -1){
    s = s.replace(a, b);
  }
  return s;
};

Related Tutorials