Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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 by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #remove #words #list #string
ADD COMMENT
Topic
Name
6+5 =