Advertisement
TZinovieva

Censored Words JS Fundamentals

Mar 6th, 2023
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function censoredWords(text, word) {
  2.     while (text.includes(word)) {
  3.         let newWord = ('*'.repeat(word.length));
  4.         text = text.replace(word, newWord);
  5.     }
  6.     console.log(text);
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement