So I want to find all items that match a string and replace them. For some reason, I can't get it to iterate and replace all. Any help would be appreciated
const word = ['h', 'e', 'l', 'l', 'o'];
var placeholder = word.map(e => {
return "*"
});
let letter = 'l';
word.forEach(e => {
if (e === letter) {
placeholder.splice(word.indexOf(letter), 1, letter);
}
});
console.log(placeholder);