Skip to content

Instantly share code, notes, and snippets.

@allysonsouza
Last active August 29, 2015 14:03
Show Gist options
  • Save allysonsouza/ef5a700386a15e4ce5a1 to your computer and use it in GitHub Desktop.
Save allysonsouza/ef5a700386a15e4ce5a1 to your computer and use it in GitHub Desktop.
Multidimensional Empty Arrays in JavaScript
var App = {
cols: 3,
init: function() {
var siblings = [];
for(var i = 0; i < this.stage.rows; i++) {
siblings[i] = [];
}
for( var j = 0; j < 1; j++ ) {
for( var k = 0; k < 1; k++ ) {
//Verification
if( (k + 1) < this.cols ) {
if ( !siblings[j][k] ) {
siblings[j][k] = [];
}
Array.prototype.push.apply(siblings[j][k], [j, k+1]);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment