Is there a usage pattern in Javascript to prevent the pitfall of 2 in [1,3,5] === true?
<p>Some usage that I find a bit tricky is</p>

<pre><code>2 in [1, 3, 5]

for (var i in [1, 3, 5]) { ... }

str = "hello";
for (var i in str) { ... }
</code></pre>

<p>the first one is <code>true</code> (I might have immediately said <code>2 in [1, 3, 5]</code> is <code>false</code>), and the second line loops through 0, 1, 2 instead of 1, 3, 5, and the last part loops through 0 to 4, instead of <code>'h', 'e', 'l', 'l', 'o'</code>.  Right now I am just using: whenever seeing <code>in</code> for array, or for-in loop for array, immediately think about index instead.  Otherwise, is there a way or usage pattern that we can use to avoid this pitfall?  </p>
