Javascript Array select(filter)
Array.prototype.select = function(filter) { var newArr = []// w w w . j a va 2 s.c om for (var i = 0; i< this.length; i++) { if(filter(this[i])){ newArr.push(this[i]); } } return newArr; }