Skip to content
Prev Previous commit
Next Next commit
ex4 is added
  • Loading branch information
amirhshad committed Nov 23, 2020
commit f68507eb413644a31e8f016c69183ce1ecaaf978
3 changes: 3 additions & 0 deletions Week2/js-exercises/ex4-collectiveAge.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

function collectiveAge(people) {
// return the sum of age for all the people
const ages = people.map(item => item.age)
const sumAges = ages.reduce((a,b) => a + b ,0)
return sumAges;
}

const hackYourFutureMembers = [{
Expand Down