How to add For loop information to Multi-Dimensional Array?
http://jsfiddle.net/MZj3L/
If I am trying this code get – map undefined. But how to save data something like to this ->
[[Array[10], [Array[10], [Array[10], [Array[10], [Array[10], [Array[10], [Array[10], [Array[10], [Array[10], [Array[10]]
Thanks and sorry for my English language.
It seems in you want to initialize a multi dimensional array. Arrays are dynamic in JavaScript, you don’t have to initialize them with a certain length. You could just do:
This gives you an array containing 10 arrays.
Why are you getting
undefined?Because your syntax is way of. What
map = [a][b];does is creating an array with one elementaand then accessing thebth element of that array and assign it tomap.So in the last iteration, it does:
which is the same as