Aug 27, 2017 · 1 min read
You should use acc.push() rather than acc.concat() .
If the callback returns an array (or, in the case of filter , if item is an array), concat will flatten the array elements which is not what you want.
You should use acc.push() rather than acc.concat() .
If the callback returns an array (or, in the case of filter , if item is an array), concat will flatten the array elements which is not what you want.