我就直接上代碼吧!直接在瀏覽器跑下就知道了!各位大神就是報了個錯functionobjectIterator(object,arr,objStack){letcount=0if(!arr.length){return}if(arr.indexOf(object.id)>-1){object.disabled=true}if(object.children.length){objStack.push(object)}else{return}console.warn(objStack.length,objStack[0])while(objStack.length){for(leti=count;i{item.parent=obj})obj.children[0].children.forEach(item=>{item.parent=obj.children[0]})objectIterator(obj,['1','2','5'],[])console.warn(obj)
javascript深度遍歷二叉樹問題
慕勒3428872
2019-05-23 17:38:01