javascript : 递归遍历数组
我们假设有一个对象数组。
这个对象数组里的对象,有一个叫children的key,value也是一个对象数组。
这个数组里面可能还有children...
现在我们想递归遍历它。
上代码。
test_parse(source){ for (var key in source) { console.log(source[key]) if (source[key].children) { this.test_parse(source[key].children) } } },
以上。
posted on 2019-04-14 19:28 fox_charon 阅读(6226) 评论(0) 收藏 举报
 
                
            
         
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号