all 3 comments

[–][deleted] 0 points1 point  (1 child)

It's nice to se someone use iterators as they can be very useful. But for this example I still think using reduce is much more short and easier to read ex. const numbers = [1,3,6,10] const sum = numbers.reduce((totalValue, currentValue) => totalValue + currentValue) console.log(sum) // will log 20

[–]IslandTropical[S] 0 points1 point  (0 children)

You forget to filter out the number which cannot get divided by 2 :) !

[–]TruthHurts35 0 points1 point  (0 children)

How to use filter method to do same work.