I have the following object:
myObject: {
myArray1: [1,2,3],
myArray2: [4,5,6],
myArray3: [7,8,9]
}
This is an object that keeps growing in Arrays(dynamic array?). So I need to figure out a method to access it. I came across using a for( var key in myObject) with something like this:
for (var key in myObject) {
var obj = myObject[key];
for (var prop in obj) {
//thinking that this will print the first value of the array
console.log(prop[0]);
}
}
but it doesn't work it prints undefined. I know using a for in is not the way to access an object correctly. I'm wondering if anyone could suggest a method to access the values of this object through a loop.
Thanks!