Advertisement
kstoyanov

04. Censored Words

Jul 16th, 2020
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(text, word) {
  2.   while (text.includes(word)) {
  3.     const lenWord = word.length;
  4.     const strR = '*';
  5.     text = text.replace(word, strR.repeat(lenWord));
  6.   }
  7.  
  8.   console.log(text);
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement