I definitely agree that reduce is a powerful build-in javascript function.
When you once understand how it works, it's hard to refrain from using it.
You can do a lot more than map values of an array, flat an array, or transform arrays into objects.
I see only one significant disadvantage - readability. Sometimes it could be hard to read for other developers what we mean using reduce function.
I definitely agree that reduce is a powerful build-in javascript function.
When you once understand how it works, it's hard to refrain from using it.
You can do a lot more than map values of an array, flat an array, or transform arrays into objects.
I see only one significant disadvantage - readability. Sometimes it could be hard to read for other developers what we mean using reduce function.
Here is a great explanation - youtube.com/watch?v=qaGjS7-qWzg
Thanks for the youtube link