Skip to content

Latest commit

 

History

History
8 lines (6 loc) · 330 Bytes

File metadata and controls

8 lines (6 loc) · 330 Bytes

Exercise 19 - totalIntegers

Write a function that takes in an arbitrarily deep array or object and returns the total number of integers stored inside this array or object.

totalIntegers([[[5], 3], 0, 2, ['foo'], [], [4, [5, 6]]]); // returns 7
totalIntegers({ a: 1, b: { a: [5, 10], b: 11 } }); // returns 4