|
|
|
|
|
by kyberias
1490 days 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? |
|