I'm working with an array of arrays that looks like this:
let matrix = [[0,1,1,2], [0,5,0,0], [2,0,3,3]]
I want to loop through each array and compare the value to the same element in the other arrays i.e. I want to compare the 0th element in the 0th array to the 0th elements in the 1th and 2nd array (in this case I would be comparing 0 to 0 and 2 respectively).
I want to iterate through the arrays comparing the current array element in the current array to it's counterpart in the following arrays i.e. look at the 0th element of this array and compare it to the 0th element in the next two arrays, then look at the 1th element in this array and compare it to the 1th element in the next two arrays, and so forth.
Compare the values 0, 0, 2
Then compare 1,5,0
Then compare 1,0,3,
Then compare 2, 0, 3
How can I do this with nested for loops? Is there a better way to do this not involving nested for loops?