I have created an object which contains a few items, including one which contains multiple objects each of which contains an array. Here is how it is structured.
$.myVar = {
cp : "",
ps : {
m1 : ["001", "002", "003"],
m2 : ["002", "004"]
}
};
My scripts keep crashing saying that $.myVar.ps["m1"] has no method each.
When I got into Chrome's console to investigate, I run the following and get the displayed output.
$.myVar.ps["m1"]
["001", "002", "003"]
$.myVar.ps["m1"].each( function (i, p) {alert(i)})
TypeError: Object 001,002,003 has no method 'each'
Also if I run the following, it proves that m1 is an array.
$.isArray($.myVar.ps["m1"])
true
So it seems to agree with m1 is an array, but it refuses to treat it as such. Any idea what I'm doing wrong?