I have an array:
myArray = [];
To which I am adding objects:
data = [];
myArray.push( {
elem1: ...,
elem2: data.push(...);
} );
So, elem2
in the object contains an array. How can I, given myArray
add new elements to the array in elem2
? I tried the following:
myArray[idx].elem2.push("new data");
But got an error saying that elem2.push() is not a method.