爬完代码返回值问题
function filtersFunction(html) { var $ = cheer.load(html) var list = $('.chapter') var nodeList = [] list.each(function (item) { var list = $(this) // console.log('list---', list) var textList = list.find('.video').children('li') var listTitle = list.find('h3').text() var nodeData = { listTitle: listTitle, textList: [] } textList.each(function (item) { var aLi = $(this).find('a') var listA = aLi.attr('href').split('video/')[1] var listText = aLi.text() nodeData.textList.push({ listA: listA, listText: listText }) }) nodeList.push(nodeData) }) console.log(nodeList) return nodeList }
打印结果
小伙伴们有知道为啥我的第二个push打印是这样的吗?