I am returned a string, fruit which could have many values, for example: banana, apple, grapes, orange, mango etc.
I want to output the value of this string, but I only want to display some of them. This has made my IF statement long & ugly:
if ( fruit != 'apple' || fruit != 'grapes' || fruit != 'banana' ) {
// display them
}
How else could I write this? Would .filter work? Can I put the unwanted fruits into an array and say if fruit matches an array value, do nothing?