DEV Community

Discussion on: Reduce method with an input of a string or an object

tqbit profile image

I always like to see elaborations about high order functions, especially .reduce looks, imo, quite counterintuitive at first. perhaps you could state what your function is attempting to do and enhance your example with an array of numbers as input.

reduce also works with other data types, like strings. that's quite handy to, for instance, dynamically create a string out of specific array elements

vikirobles profile image
Vicky V Author

I added another two examples. Thanks for your feedback. :)