Created
September 21, 2017 15:33
-
-
Save malte-j/b06fdf03720e7793636fb704beeadb4c to your computer and use it in GitHub Desktop.
JS 2D Array
This file contains 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 Create2DArray(rows, columns) { | |
var arr = []; | |
for (var i = 0; i < rows; i++) { | |
var col = []; | |
for (var j = 0; j < columns; j++){ | |
col[j] = 0; | |
} | |
arr[i] = col; | |
} | |
return arr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment