function getAvarageAge(arr){
return arr.reduce((sum, item) => sum + item, 0) / arr.length
}
let vasya = { name: "Вася", age: 25 };
let petya = { name: "Петя", age: 30 };
let masha = { name: "Маша", age: 29 };
let arr = [ vasya, petya, masha ];
alert()
{ name: 'Вася', age: 25 }
function getAvarageAge(arr) {
return arr.reduce((sum, item) => sum + item.age, 0) / arr.length;
}
let vasya = { name: 'Вася', age: 25 };
let petya = { name: 'Петя', age: 30 };
let masha = { name: 'Маша', age: 29 };
let arr = [vasya, petya, masha];
console.log(getAvarageAge(arr)); // 28