---
title: "Comment by Hussein Kizz on \"Super Useful Tips & Tricks for JavaScript Developers\" | Hashnode"
description: "This article is so useful, cause I recently had an array with something like arr = [ {name: foo, count:2}, {name2: doe, count:5} ] and I wanted to convert all c"
url: "https://hashnode.com/posts/super-useful-tips-and-tricks-for-javascript-developers/60a9eddb20d1f45ceb7eef74/comment/60aacd0f20d1f45ceb7f063c"
---

[Discussion](https://hashnode.com/posts/super-useful-tips-and-tricks-for-javascript-developers/60a9eddb20d1f45ceb7eef74)

Comment [Super Useful Tips & Tricks for JavaScript Developers](https://hashnode.com/posts/super-useful-tips-and-tricks-for-javascript-developers/60a9eddb20d1f45ceb7eef74)

[Hussein Kizz](https://hashnode.com/@husseinkizz)

[May 23, 2021](https://hashnode.com/posts/super-useful-tips-and-tricks-for-javascript-developers/60a9eddb20d1f45ceb7eef74/comment/60aacd0f20d1f45ceb7f063c)

This article is so useful, cause I recently had an array with something like arr = \[ {name: foo, count:2}, {name2: doe, count:5} \] and I wanted to convert all count values to percentage while maintaining names as they're and get results into a new array, I think the add function and dynamic object trick you have provided here can make it work, I just haven't figured it out. But in all this is awesome, thanks!

[Yogesh Chavan](https://hashnode.com/@myogeshchavan97)

[May 24, 2021](https://hashnode.com/posts/super-useful-tips-and-tricks-for-javascript-developers/60a9eddb20d1f45ceb7eef74/comment/60aacd0f20d1f45ceb7f063c#reply-60ab04e15379f65d10b62066)

Thanks [Hussein Kizz](https://hashnode.com/@husseinkizz). Glad this article was useful to you. But I think I have not understood what you're trying to do. Are you trying to add all count values to calculate the percentage?

[Hussein Kizz](https://hashnode.com/@husseinkizz)

[May 24, 2021](https://hashnode.com/posts/super-useful-tips-and-tricks-for-javascript-developers/60a9eddb20d1f45ceb7eef74/comment/60aacd0f20d1f45ceb7f063c#reply-60ab0bc720d1f45ceb7f0885)

oh yeah [Yogesh Chavan](https://hashnode.com/@myogeshchavan97) thanks, I was trying to do that but I shouted out on the tech twitter community and got help. it's using Array reduce and map and get it to work, here is the tweet: [twitter.com/HusseinKizz/status/1396586056267407362](https://twitter.com/HusseinKizz/status/1396586056267407362)

[Yogesh Chavan](https://hashnode.com/@myogeshchavan97)

[May 24, 2021](https://hashnode.com/posts/super-useful-tips-and-tricks-for-javascript-developers/60a9eddb20d1f45ceb7eef74/comment/60aacd0f20d1f45ceb7f063c#reply-60ab3e6820d1f45ceb7f0cfb)

[Hussein Kizz](https://hashnode.com/@husseinkizz) It's great to hear that you've finally solved the issue
