Skip to content

Commit c3f6fad

Browse files
final task completed and problem 50 solved
1 parent 48f0402 commit c3f6fad

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

problem50/problem50.js

+8
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,11 @@ for( let i = 0; i < people.length; i++){
3535

3636
console.log(sumOfAge);
3737

38+
/* ================================================
39+
Final task using for reduce()
40+
===================================================*/
41+
const allAges = people.map(x => x.age);
42+
const ageTotal = allAges.reduce((previoustotal, presentValue) => previoustotal + presentValue,0);
43+
44+
45+
console.log(ageTotal);

0 commit comments

Comments
 (0)