javascript remove some words list from string
function removeFromString(words, str) { return words.reduce((result, word) => result.replace(word, ''), str) } const str = "Remove one, two, not three and four" const result = removeFromString(["one, two, " , "and four"], str) console.log(result) Run code snippet
Source: stackoverflow.com