I've got a serious bug, which I've never seen before. First of all I've a simple Array:
var myArray = ["123", "456", "789"]
Now I want to iterate over this Array with a for..in - loop:
function mapData(list) {
for ( var i in list) {
var item = list[i];
if (item) {
// do something
}
}
}
After calling the method with mapData(myArray), firebug shows in the debugger this:
- Loop: i = 0; item = 123;
- Loop: i = 1; item = 456;
- Loop: i = 2; item = 789;
- Loop: i = compare;
- Loop: i = union;
- Loop: i = remove;
- Loop: i = select;
- Loop: i = contains;
So I think that are the prototype functions. But why? Any Ideas?
As I mentioned, I've never seen this before...
for..inis supposed to do this; it's for iterating Objects, not Arrays, so if there are any enumerable properties, inherited or otherwise, they will be iterated over.