I was trying to resolve my error with other answers but just fail. I have this simple example of what I think is two-dimensional array but it keeps returning me undefined error.
var city = 'London',
country = 'England';
var locate = [];
locate['London']['England'] = ['Jhon','Mike'];
for (i = 0; i < locate[city][country].length; i++) {
console.log(locate[city][country][i]);
}
jsbin http://jsbin.com/pixeluhojawa/1/
what am I doing wrong in this example, I would appreciate your help.
locate['London']is clearly undefined.