It can be as simple as that:
const arr = ['banana', 'monkey banana', 'apple', 'kiwi', 'orange'];
const checker = value =>
!['banana', 'apple'].some(element => value.includes(element));
console.log(arr.filter(checker));
ECMAScript 6 FTW!
The checker uses an arrow function.
The ! means that it will exclude all elements that doesn’t meet the conditions.
The
some()method tests whether some element in the array passes the test implemented by the provided function.
from Array.prototype.some() docs on MDM
The
includes()method determines whether one string may be found within another string, returningtrueorfalseas appropriate.
from String.prototype.includes() docs on MDM
As some latest ECMAScript features aren’t supported in all browsers, you should use Babel to compile your code to ECMAScript 5.