const findTheOldest = function(array) { const oldest = array.sort((a, b) => { let yearNow = (new Date()).getFullYear(); let ageA = ((a.yearOfDeath) ? a.yearOfDeath : yearNow) - a.yearOfBirth; let ageB = ((b.yearOfDeath) ? b.yearOfDeath : yearNow) - b.yearOfBirth; return (ageA > ageB) ? -1 : 1; })[0]; return oldest; }; // Do not edit below this line module.exports = findTheOldest;