I checked other questions to solve this but I can not figure it out how to solve it in my case: I want to loop through all the items of an array of objects and access to an specific property.
for (var i = 0; i < myArray.length; i++){
var x = myArray[i].property;
console.log(x);
}
My data array structure:
var myArray = [
firstObject: {
title:"first",
content:"lorem ipsum"
},
secondObject: {
title:"second",
content:"lorem ipsum"
},
thirdObject: {
title:"third",
content:"lorem ipsum"
}
]
Inspecting the console output to be a list of each instance of the object in myArray, but it only retrieves the first object from it. So, how can I access properly to these values? Thanks