DEV Community

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

Collapse
 
jonrandy profile image
Jon Randy 🎖️ • Edited

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

Collapse
 
joachimzeelmaekers profile image
Joachim Zeelmaekers

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.