I am having issues looping through a nested JavaScript array and need some help. I am trying to return a set of list items with both the property name and the value, but it's returning as undefined. Any help would be much appreciated as this is an important project.
JavaScript
$.getJSON("item-data.json", function(results) {
$.each(results.CatalogEntryView, function(index, item) {
console.dir(item.ItemDescription[0].features);
document.getElementById("productHighlightsList").innerHTML = item.ItemDescription[0].features.forEach(enumerateProperties)
function enumerateProperties(key, val)
{
return "<li>" + key + val + "</li>"
}
});
});
The console output from console.dir(item.ItemDescription[0].features); can be seen below and shows the nested data structure I am trying to access:
