This is a stupid question, it feels like one. But mental block is bad right now. :(
My problem is I have an array consisting only of numbers. I want to use that array as a lookup, but the number I pass to lookup a number in the array keeps looking to the array in the index of that number, not whether that number exists in the array.
For example:
var a = [2,4,6,8,10],
b = 2;
if(a[b]){ /* if the number 2 exists in the array a, then do something * }
But that looks at the array value in position 2 (6), not whether the value 2 is in the array. And this makes perfect sense, but (mental block) I can't figure out a way to test whether a number exists in an array of numbers... I even made everything strings, but it does type coercion and the problem persists.
Pulling my hair out here. Please help, thanks. :D