Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Iterating over Arrays for IE using JQuery
if (typeof Array.prototype.indexOf == "undefined") {
Array.prototype.indexOf = function(value) {
for (var i = 0; i < this.length; i++) {
if (this[i] == value) {
return i;
}
}
return -1;
}
}
if (typeof Array.prototype.filter == "undefined") {
Array.prototype.filter = function(proc) {
var result = []
for (var i = 0; i < this.length; i++) {
if (proc(this[i])) {
result.push(this[i]);
}
}
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.