Commit bfc9b3b1 authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Corrected collate function

parent f69ad389
...@@ -25,7 +25,7 @@ function collate(array, rows = 2) { ...@@ -25,7 +25,7 @@ function collate(array, rows = 2) {
let row = []; let row = [];
array.forEach((value, index) => { array.forEach((value, index) => {
row.push(value); row.push(value);
if (index % rows === 0) { if ((index + 1) % rows === 0) {
collatedArray.push(row); collatedArray.push(row);
row = []; row = [];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment