今日同事遇到递归问题
function isExpandedLeftCategory(node) {
.....
if (A==B) {
return true;
} else {
for (var i = 0; i < childrenList.length; i++) {
isExpandedLeftCategory(childrenList[i]);
}
}
}
// return undefined
总结原因,递归需要return返回; 使用:return isExpandedLeftCategory(childrenList[i]);即可