Var arr = [{id: 1, name: 'Joe'}, {id: 2, name: 'bill'}, {id: 3, name: 'Cathy'}, {id: 4, name: 'liu eight'}, ] Array.prototype.myFind = function(fn){ for(var i = 0; i<this.length ; i++){ if(fn(this[i],i)){ return this[i] } } } var ret = arr.myFind(function(item,index){ return item.id === 4 })Copy the code