Javascript Array contains(key, value)
Array.prototype.contains = function(key, value) { var i = this.length; while (i--) { if (this[i][key] === value){ return true; }//w w w .jav a2 s . co m } return false; }