Hello everyone, I am a beginner in JavaScript and I have a question about how to filter out two words from one string based on another string.
string1 = ['mango', 'iPhone', 'banana', 'computer', 'apple', 'keyboard', 'strawberry'];
string2 = ['mango', 'banana', 'apple', 'strawberry'];
const string3 = string1.filter(if (word) {})
This is what I have tried so far. I am unsure of what parameters to include in the filter() method. (1) I want to check if any word from string 1 matches with any word in string 2, (2) then exclude those words (3) and store the remaining ones in string 3.
If there are alternative methods to achieve the same result, I would greatly appreciate any suggestions.