top | item 31376206

(no title)

kyberias | 3 years ago

Seems like you want to get the count of "leaves" in a tree expressed as array of arrays.

  ```
  const lengthParam = (a) => {
    let count = 0;
    for(let c of a) {
        if(Array.isArray(c)) {
            count += lengthParam(c)
        }
        else {
            count++;
        }
    }
    return count;
  };
  ```
Am I hired?

discuss

order

No comments yet.