Corrected collate function

This commit is contained in:
Jose Ivan Vargas 2017-09-01 12:22:15 -05:00
parent f69ad38910
commit bfc9b3b1b3

View file

@ -25,7 +25,7 @@ function collate(array, rows = 2) {
let row = [];
array.forEach((value, index) => {
row.push(value);
if (index % rows === 0) {
if ((index + 1) % rows === 0) {
collatedArray.push(row);
row = [];
}