i want to create a array:
myarray:array [
"test1" = [
[0] =
{
name: "mike",
friend: "tom"
}
]
]
"test2": [
[0] =
{
name: "mike",
friend: "tom"
}
],
[1] =
{
name: "mike",
friend: "tom"
}
]
]
]
how i can dynamically add Objects?
In php i would do something like that:
$content = {name: "robert", friend: "mike"}
$myarray[$group][] = $content; // Group is the dynamic element
in Javascript i try this:
myarray[group].push({
name: "mike", friend: "-"
})
// group is the dynamic element
but he failed with Cannot call method 'push' of undefined on the first call.
I don't know how many "groups" there are so i cannot init the array with all the group.
group? Where you want to push?