To not iterate through function of Array object if it is added to Array prototype
- by Rishat Muhametshin
According to the way to add indexOf method to Array class in IE6, how do I now reject this method from iterating through any random array? For example:
Array.prototype.indexOf = function(needle) { ... };
var array = [1, 2, 3];
for (var i in array) {
document.write(i + ': ' + array[i]);
}
gives output
0: 1
1: 2
2: 3
indexOf: function ...
How can I skip indexOf property and stop iterating on it without adding any code to where
for(...)
is called?