About me
I’ve started my way into programming and algorithms with Java. It doesn’t mean that I’m a pro in the back-end. It just means that I understand the Java syntax and OOP.
I’ve always been good at math but my way of Frontend was very implemented.
I’m interested in Architecture and Art. I understand something in Civil engineering and Renovation. Also, I have good teaching skills (I think so) and sometimes I’m in the spotlight. Because I like to connect with people, make jokes and be a serious person at the same time..
So if you read it welcome to my Universe. And nice to meet you, friend =)
Code Example
Array.prototype.length will give you the number of top-level
elements in an
Your task is to create a function deepCount that returns the number of ALL
elements within an array, including any within inner-level arrays.
For example:
deepCount([1, 2, 3]); //>>>>> 3
deepCount(["x", "y", ["z"]]); //>>>>> 4
deepCount([1, 2, [3, 4, [5]]]); //>>>>> 7
function deepCount(a){
let sum = a.length;
a.forEach(el => {
if(Array.isArray(el)) {
sum += deepCount(el);
}
});
return sum;
}