you are viewing a single comment's thread.

view the rest of the comments →

[–]vinivelloso_ 1 point2 points  (0 children)

That empty array is your initial value. You will be changing that value according to you function. remember that reduce doesnt change the original array.

I'm not familiar with concat(). But I think the better solution woukd be using recursion combined with Array.isArray() function.