How to iterate through nested objects in JS

前端 未结 4 852
小鲜肉
小鲜肉 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:59

    $.each(window.books,function(k,v){   // k ==== key, v === value
            // Prints category
            console.log(k); 
    
            //Loops through category
            for(i=0,len=v.length;i

提交回复
热议问题