Struggling to extract elements from a multidimensional array in JavaScript. Running into an issue where attempting to access elements from arrays within the main array using a variable results in undefined
. Surprisingly, I achieve the desired outcome when utilizing a number instead of a variable.
let arr = [[1,2,3],[4,5,6],[7,8,9]];
for(let i=0; i < arr.length; i++) {
console.log(arr[i][arr.length]);
}