replaceAll String


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function replaceAll(string, token, newtoken) {
  2. while (string.indexOf(token) != -1) {
  3. string = string.replace(token, newtoken);
  4. }
  5. return string;
  6. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.