re: Unrolling Matrix Walkthrough - JS VIEW POST

FULL DISCUSSION
 

Hi Kim, I've appreciated your exercise!
Anyway, because I love short writing I prefer to use functional methods and ES6.
Try this, for example:

const arr = [[1, 2, 3, 4], [5,6,7,8], [9,10,11,12], [13,14,15,16]];
console.log(arr);
console.log(arr.reduce((prev,curr,idx,[]) => [...prev,...curr]).toString());

Have a nice week end!

code of conduct - report abuse