I am using Array.prototype.find to search an Object Person in an Array. I would like use the id to find this Object. I've been reading about the method find (ES6) but I don't know why my code is wrong.
This is my code:
AddresBook.prototype.getPerson = function (id) {
return this.lisPerson.find(buscarPersona, id);
};
function buscarPersona(element, index, array) {
if (element.id === this.id) {
return element;
} else
return false;
}