0
help
ayormeday (7)

how do i modify the function to return the total summed age of all of the people.

function getSummedAge(people) {

const arrSum = arr => arr.reduce((name,age) => name + age, 0)
}

/ Do not modify code below this line /

const examplePeopleArray = [
{ name: 'John', age: 10 },
{ name: 'Jack', age: 20 },
{ name: 'Jane', age: 25 }
];

console.log(getSummedAge(examplePeopleArray), '<-- should be 55');

You are viewing a single comment. View All
1
ash15khng (215)

@heyitsmarcus It's satisfying when you can do relatively complicated stuff in one or two lines with functional programming.