Saturday 18 November 2017

How to check if a variable is equal to any of the elements in an array?

I'm making a little project and here's my issue:const siccTraits = ["Strength", "Intelligence", "Charisma", "Cunning"];Let's say I store the user's input (which is going to be one word) into a variable x. How would I check if the variable X is equal to any of those elements in that array?if (x === whatDO) { do somethign here } PS: I know how to get the user's input and make if statements, I just don't know the other part.

Submitted November 18, 2017 at 04:25PM by Bucketlava

No comments:

Post a Comment