DEV Community


Discussion on: Clean up your code by applying these 7 rules ⚡️

jonrandy profile image
Jon Randy

Why so verbose? Why not just:

const mergeArrays = (...arrays) => arrays.reduce((merged, arr) => [...merged, ...arr])
Enter fullscreen mode Exit fullscreen mode

It's equally readable

joachimzeelmaekers profile image
Joachim Zeelmaekers Author

Well it’s just to make the code snippet clear. As I said in the article, it could be replaced by a nice oneliner, but that’s not really the point of this article.