const age = person.sort((item1, item2) => (item1.age - item2.age));
const age = person => {
let amount;
for (let i = 0; i < person.length; i++) {
for (let j = i; j < person.length; j++) {
if (person[i] > person[j]) {
amount = person[i];
person[i] = person[j];
person[j] = amount;
}
}
}
return person;
}
const res = [3, 4, 2, 78, 0, 1];
console.log(age(res));