Possible Duplicate:
array.contains(obj) in JavaScript
Something like:
if (mystring == "a" || mystring == "b" || mystring =="c")
I was hopping to do:
if (mystring in ("a", "b", "c"))
is it possible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could use
indexOf()like thisEDIT With ES7 comes a little simplification. As of today just Chrome 47+ and FF 43+ seem to support it:
Array.prototype.includes()