Skip to content

Instantly share code, notes, and snippets.

@Alexzanderk
Last active September 14, 2018 17:53
Show Gist options
  • Save Alexzanderk/deb2e0e2e708469bbd6bbeb97aae17ec to your computer and use it in GitHub Desktop.
Save Alexzanderk/deb2e0e2e708469bbd6bbeb97aae17ec to your computer and use it in GitHub Desktop.
одномерный массив в двухмерный и более
function toMatrix(arr, rowSize) {
var store = [];
for (var i = 0; i < arr.length; i += rowSize) {
store.push(data.slice(i, i + rowSize)); /*?*/
}
return store;
}
toMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9], 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment