How to find the highest dimension of a multi-dimensional array?

There is an array,
arr = [2,[2],[[[2]]],3]

My code should return, 4.
Because [[[2]]] is in the 4th dimension as well as the highest dimension of arr.

You could count with a while loop or recursion.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.