Javascript Array where(predicate, context)
Array.prototype.where = Array.prototype.filter || function (predicate, context) { context = context || window;//from w w w. j av a2s . c o m var arr = []; var l = this.length; for (var i = 0; i < l; i++) if (predicate.call(context, this[i], i, this) === true) arr.push(this[i]); return arr; };