Multidimensional Array 3×3 matrix javascript

How to work with 3×3 matrix multidimensional array…

var myStack = new Array(3);
for (var i = 0; i < 3; i++) {
myStack[i] = new Array(3);
for (var j = 0; j < 3; j++) {
myStack[i][j] = new Array(3);
for (var k = 0; k < 3; k++) {
myStack[i][j][k] = new Array(3);
myStack[i][j][k] = 10;
}
}
}
console.log(myStack);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s