Takes an array and returns an array of arrays with a length of columnsNumber.
columnsNumber
columns
const a = [1, 2, 3, 4, 5, 6];const b = columnify(2)(a);console.log(b); // [[1, 3, 5], [2, 4, 6]] Copy
const a = [1, 2, 3, 4, 5, 6];const b = columnify(2)(a);console.log(b); // [[1, 3, 5], [2, 4, 6]]
Takes an array and returns an array of arrays with a length of
columnsNumber
.columns
number is greater than the length of the input array, the resulting arrays will be empty.columnsNumber
is less than 1, it will be set to 1.Example