If I have an array like so:
let arr = [
[],
[],
[
1, 2, ["a"]
]
]
I want to get an item from the array given an array of indices.
Here is an example:
let arr = [
[],
[],
[
1, 2, ["a"]
]
]
function findByIndex(arr, indices) {
// code here
}
findByIndex(arr, [2, 2, 0])
// returns `arr[2][2][0]` which is "a"
How can I do this?