Last active
September 14, 2018 17:53
-
-
Save Alexzanderk/deb2e0e2e708469bbd6bbeb97aae17ec to your computer and use it in GitHub Desktop.
одномерный массив в двухмерный и более
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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