How to check if a string array contains one string in JavaScript? [duplicate]

I have a string array and one string. I’d like to test this string against the array values and apply a condition the result – if the array contains the string do “A”, else do “B”.

How can I do that?

5 Answers
5

Leave a Comment