js递归删除树节点无效

debug走完,数据还是没变化。

                let result = getEleDatas(search);

                //-------------------对结果过滤市本级节点------------------
                function removeNodeForList(list){
                    if (list && list.length > 0){
                        for(let i =0;i<list.length;i++){
                            if(list[i]['children'] && list[i]['children'].length > 0){
                                removeNodeForList(list[i]['children']);
                            }else{
                                let code = list[i]['code'];
                                if(code && code.substr(4, 2) == '00'){
                                    list.slice(i,1)
                                }
                            }
                        }
                    }
                }
                removeNodeForList(result);

img

第12行:list.slice(i, 1)改为list.splice(i, 1)

是不是不能用=='00',而是用equal('00')啊