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!
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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!