Consider following code:
var arr = [111, 222, 333];
for(var i in arr) {
if(i === 1) {
// Never executed
}
}
It will fail, because typeof i === 'string'.
Is there way around this? I could explicitly convert i to integer, but doing so seems to defeat the purpose using simpler for in instead of regular for-loop.
Edit:
I am aware of using == in comparison, but that is not an option.