← Back to challenges

Total Count of Numbers in a MultiDimensional Array

JavaScriptHardlanguage_fundamentalsarraysrecursiondata_structuresregex

Instructions

Create a function that takes a multidimensional array and return the total count of numbers in that array.

Examples

countNumber([["", 17.2, 5, "innokodakademija"]]) ➞ 2
// 17.2 and 5.

countNumber([[[[[2, 14]]], 2, 3, 4]]) ➞ 5
// 2, 14, 2, 3 and 4.

countNumber([["balkot"]]) ➞ 0

Notes

Input may be array of numbers, strings and empty arrays.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Noddy's Mystery Function