I\'m having some issues comparing the elements of two arrays and filtering out matching values. I only want to return array elements that are NOT included within wordsToRe
wordsToRe
That is pretty easy to do using Array.prototype.filter:
Array.prototype.filter
var fullWordList = ['1','2','3','4','5']; var wordsToRemove = ['1','2','3']; var filteredKeywords = fullWordList.filter( word=>!wordsToRemove.includes(word) //or //word=>wordsToRemove.indexOf(word)<0 );