I\'m used to python, so
a = [1,2,3] 1 in a # -> True b = [\"1\", \"2\", \"3\", \"x\"] \"x\" in b # -> True
Why is it that in JavaScript>
in works on KEYS of arrays, not values. 1 in a succeeds because there is an element #1 in your array, which is actually the 2 value.
in
1 in a
2
"1" fails, because there is no 1 PROPERTY or KEY in your array.
"1"
1
Details here: https://developer.mozilla.org/en/JavaScript/Reference/Operators/in