Created
November 30, 2017 12:49
-
-
Save EleotleCram/374ab6761dbd74e63a21f8d83bba163e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// arrayDepth() => 0 | |
// arrayDepth([]) => 1 | |
// arrayDepth([[]]) => 2 | |
// arrayDepth([[[]]]) => 3 | |
// arrayDepth([[[[]]]]) => 4 | |
const arrayDepth = (ary) => _.isArray(ary) ? 1+arrayDepth(ary[0]) : 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment