Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(args) {
- const text = args.shift().split(' ');
- const words = args.pop();
- words.forEach((newWord) => {
- const searchWord = '_'.repeat(newWord.length);
- text.forEach((word, index) => {
- if (word === searchWord || word === (`${searchWord},`) || word === (`${searchWord}.`)) {
- text.splice(index, 1, newWord);
- }
- });
- });
- console.log(text.join(' '));
- }
Add Comment
Please, Sign In to add comment