IB
Size: a a a
IB
ВВ
IB
А
const getOldest = people => {
let oldest = []
let maxAge = 0
for (const person of people) {
if (person.age > maxAge) {
oldest = [person]
maxAge = person.age
} else if (person.age == maxAge) {
oldest.push(person)
}
}
return oldest.length == 1 ? oldest[0] : oldest
}
Как то так, отформатировать
и проверить нет возможностиIB
ВВ
ВВ
IB
ВВ
AP
AP
IB
IB
AP
O
IB
O
IB