---
title: "Comment by Ranadheer Reddy on \"Build your JavaScript Muscles with map, reduce, filter and other array iterators\" | Hashnode"
description: "Great Article. Thanks for sharing. Following is my suggestion We can even calculate the amount spent by married couples without using map function (directly use"
url: "https://hashnode.com/posts/build-your-javascript-muscles-with-map-reduce-filter-and-other-array-iterators/5d3e9c83876d7eb83cb58d6e/comment/5d4a7b1ce058b029109cb4f3"
---

[Discussion](https://hashnode.com/posts/build-your-javascript-muscles-with-map-reduce-filter-and-other-array-iterators/5d3e9c83876d7eb83cb58d6e)

Comment [Build your JavaScript Muscles with map, reduce, filter and other array iterators](https://hashnode.com/posts/build-your-javascript-muscles-with-map-reduce-filter-and-other-array-iterators/5d3e9c83876d7eb83cb58d6e)

[Ranadheer Reddy](https://hashnode.com/@Ranadheer)

[Aug 7, 2019](https://hashnode.com/posts/build-your-javascript-muscles-with-map-reduce-filter-and-other-array-iterators/5d3e9c83876d7eb83cb58d6e/comment/5d4a7b1ce058b029109cb4f3)

Great Article. Thanks for sharing. Following is my suggestion

We can even calculate the amount spent by married couples without using map function (directly use customer in reduce function)

const total = customers .filter(customer => customer.married) .reduce((accum,customer) => accum + customer.expense);

[Tapas Adhikary](https://hashnode.com/@atapas)

[Aug 7, 2019](https://hashnode.com/posts/build-your-javascript-muscles-with-map-reduce-filter-and-other-array-iterators/5d3e9c83876d7eb83cb58d6e/comment/5d4a7b1ce058b029109cb4f3#reply-5d4afc21be7b95b432e685bb)

[Ranadheer Reddy](https://hashnode.com/@Ranadheer), Thank You!

Yes we can. Your example looks perfect to me.
