Friday, August 24, 2012

comparison – JavaScript: Simple way to check if variable is equal to one of two strings?

Is there an easier way to determine if a variable is equal to a range of values, such as:



if x === 5 || 6


rather than something obtuse like:



if x === 5 || x === 6


?






Rating: 1 out of 5 based on 7 ratings



The post comparison – JavaScript: Simple way to check if variable is equal to one of two strings? appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/comparison-javascript-simple-way-to-check-if-variable-is-equal-to-one-of-two-strings.html

No comments:

Post a Comment