Your first example chokes on [1,[2,3,[4]],5,[6,7]], throwing an error. Worse, on ['yo',['dawg','I',['herd']],'you',['like','arrays']] it breaks in a number of interesting ways, spreading some strings, failing to spread some arrays.
Sorry to hear you feel that way. I was just suggesting that using mutation in reduce is confusing, didn't mean for it to turn into this long-running back and forth.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Your first example chokes on
[1,[2,3,[4]],5,[6,7]]
, throwing an error. Worse, on['yo',['dawg','I',['herd']],'you',['like','arrays']]
it breaks in a number of interesting ways, spreading some strings, failing to spread some arrays.It is an implementation of the join function for arrays, and works with arrays of arrays, not arrays of mixed objects.
If you need it to work with mixed objects you'll need a recursive call (or
ap
+pure
):Anyway, the point is to avoid mutation in the
reduce
, whatever it is you may be implementing.At this point it honestly seems like you're just trying to score points against me, in some way. I am disinterested in continuing that.
Sorry to hear you feel that way. I was just suggesting that using mutation in
reduce
is confusing, didn't mean for it to turn into this long-running back and forth.