I have the following code, with the intention of defining and using a list of objects, but I get an 'undefine' for post_title
. What am I doing wrong? I don't want to name the array as a property of an object, I just want a collection/array of objects.
var templates = [{ "ID": "12", "post_title": "Our Title" }
, { "ID": "14", "post_title": "pwd" }];
function templateOptionList() {
for(var t in templates) {
console.log(t.post_title);
}
}
$(function () {
templateOptionList();
});