Array filter for IE

by Ritesh Pandey

HTML

<!-- Array prototype filter for IE -->

JavaScript

// Array filter for IE

Array.prototype.filter = function (callback, scope) {
    var i, filteredArray = [];
    if (scope === undefined) {
        scope = this;
    }
    for (i=0; i<this.length; i++) {
        isAllowed = callback.call(scope, this[i], i, this);
        if (isAllowed === true) {
        	filteredArray.push(this[i]);
        }
    }
    return filteredArray;
}