How to iterate through nested objects in JS

前端 未结 4 857
小鲜肉
小鲜肉 2021-02-06 14:28

Ok I\'m stumped on this one. I need to iterate through these so I can make a listing by the category so something like

Business Books

Book 1

4条回答
  •  臣服心动
    2021-02-06 14:46

    jQuery.each(window.books, function(category, items) {
        alert(category);
    
        jQuery.each(items, function(idx, book) {
            alert(category + ': ' + book.Title)
        });
    });
    

提交回复
热议问题