I am trying to walk through a JS object, with the for_in loop. That seems to be returning the found value (contentCard1) as plain text. I can't get it to print val.text
var contentCards = {
contentCard1: {text: "text in here", date: "date in here"}
}
for(var val in contentCards) {
console.log(val.text);
}
Logging val.text
gives me undefined
, and logging just val
gives me contentCard1
.
Thanks for helping.