Created
January 18, 2013 08:17
-
-
Save nirname/4563116 to your computer and use it in GitHub Desktop.
Iterating over Arrays for IE using JQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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