To not iterate through function of Array object if it is added to Array prototype
Posted
by
Rishat Muhametshin
on Stack Overflow
See other posts from Stack Overflow
or by Rishat Muhametshin
Published on 2012-06-22T10:50:28Z
Indexed on
2012/06/24
15:16 UTC
Read the original article
Hit count: 189
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?
© Stack Overflow or respective owner