4 ms·
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
by kyberias 4y 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?