string 1 = ['mango', 'iPhone', 'banana', 'computer', 'apple', 'keyboard', 'strawberry']
string 2 = ['mango', 'banana', 'apple', 'strawberry']
Hi, guys. I'm very new to JavaScript and just want to ask how can I filter string 2 words from string 1.
const string 3 = string1.filter(if (word) {})
This is how I came up so far. I'm not so sure what to write in filter() method. (1) I want to say if string 1 words match with string 2 words, (2) then I want to exclude them (3) and I want to have store rest of them in string 3.
It there are other ways to achieve the same result that would be also appreciated.
Aucun commentaire:
Enregistrer un commentaire