Javascript Array filterByField(field, value)
Array.prototype.filterByField = function (field, value) { var list = this; var listReturn = []; list.forEach(function(item) {//from www. ja va2s. c o m if (item[field] === value) { listReturn.push(item); } }); return listReturn; };