July 8th, 2024
What's missing in this code?
// Our words have been censored with asterisks!
// Can you help us get it back?
const word = 'i r*al*y h*te* i**';
const removed = 'eladt!';
// uncensor(word, removed); // i really hated it!
function uncensor(word, insertions)
let result = '';
let index = 0;
for (let i = 0; i < word.length;
)
if (word[i] === '*')
result +=
;
index++;
} else
result +=
;
}
}
return result;
Type or select from these options