Suppose I have this setup:
var whatever = new Array();
whatever["a"] = new Array();
whatever["a"]["a"] = "test1";
whatever["a"]["b"] = "test2";
whatever["b"] = new Array();
whatever["b"]["a"] = "test3";
whatever["b"]["b"] = "test4";
And I attempt to iterate through it:
$.each(whatever, function(key, value) {
$.each(value, function(subkey, subvalue) {
//stuff with key, subkey, and subvalue here
});
});
Yet the iteration fails, commenting out the nested foreach loop will allow the page to load, so that appears to be where the problem is.
Inside the first loop, I can do something like:
alert(value["a"]);
and receive the proper value, so it seems to be a "valid" array. Where am I going wrong, since the nested loop is basically the same as the outer one?