Home » Javascript » javascript access multidimensional array with variable as level

javascript access multidimensional array with variable as level

Posted by: admin February 24, 2020 Leave a comment

Questions:

JavaScript

How to access multidimensional array with variable as level
example :

 data = [1,2, ['a','b', ['x','z'] ] ]

i want to get ‘x’ without using this method

 data[0][0]

I want to enter (3) or the nested level of cybled array to get ‘x’

any idea plz

How to&Answers: