I have a ternary operator which sees if values in an array are the same as my targeted value. Is there an easy way to do what I'm trying to do to save me a lot of time and hard coding in array indexes. Is there a way to not use a lot of or operator?
I essentially have a long list of array indexes to compare against like this:
(price[0] === this.props.result.cost ||
price[1] === this.props.result.cost ||
price[2] === this.props.result.cost ||
price[3] === this.props.result.cost ||
price[4] === this.props.result.cost )
? this
: that
I feel like there is something basic that I'm missing or some other way completely to make this an easier task to do.