I have an existing Javascript Array with Keys, like:
var myArray = new Array();
myArray.push({ "id":"A123", "pwd":"helloworld", "items":[] });
So the ..
myArray["items"] <-------- will store multi-dimension Arrays inside again.
.. is currently a blank room.
Then now, how do I add new multiple Arrays into this myArray["items] room?
Lets say I have a loop to add items (total count is dynamic then):
foreach(.......)
{
var newItem = [{"itemcode": "i1001", "itemname": "apple"}];
myArray.items.push( newItem ); // NOT WORKING
myArray["items"] = newItem; // NOT WORKING ALSO
}
Simply debug like this:
alert( JSON.stringify( myArray ) );
.. and it is returning the Array Structure but the "items" room is blank.
So how do I dynamically add new Objects into an existing Array room, with KEY, please?