Given an array of arrays [of arrays ...] such as:
array[a][b][c][d][e]
And an array of indexes:
indexes = [ a, b, c, d, e ]
You can use Array.reduce() to go through the indexes and get the element you want.
indexes
// array[a][b][c][d][e] var indexes = [ a, b, c, d, e ]; var element = indexes.reduce(function(prev, curr){ return prev[curr]; }, array);