Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for [old] Zigzag Array by mozurin
"use strict";
function createZigzag(rows, cols, start=1)
{
return [...Array(rows).keys()].map(
r => [...Array(cols).keys()].map(c => r * cols + c + start)
).map(
(row, n) => n % 2? row.reverse() : row
);
}
April 9, 2019