JS recursive

Today my colleagues encountered Recursion 

function isExpandedLeftCategory(node) {
      .....
      if (A==B) {
        return true;
      } else {
        for (var i = 0; i < childrenList.length; i++) {
            isExpandedLeftCategory(childrenList[i]);
        }
      }
  }
//  return undefined

  

Summarized reasons, need to return to return to the recursive; use: return isExpandedLeftCategory (childrenList [i]); to

 

Guess you like

Origin www.cnblogs.com/ljyqd/p/11584808.html