It refers to the index or key, not the value. 0
and 1
are the valid indices for that array. There are also valid keys, including "length"
and "toString"
. Try 2 in x
. That will be false (since JavaScript arrays are 0-indexed).
See the MDN documentation.