Javascript Array find(func)
// given a function that takes a single element as an argument // returns the first element in the array that satisfies the function Array.prototype.find = function(func) { for(var i in this) { if(func(this[i])) return this[i] }//from w w w. j a va 2 s . com return null }