I am using this tutorial to get the largest 'first' [0] value of a multidimensional array.
array = [[1, 5], [4, 7], [3, 8], [2, 3],
[12, 4], [6, 6], [4, 1], [3, 2],
[8, 14]]
array.reduce(function(max, arr) {
return max >= arr[0] ? max : arr[0];
}, -Infinity);
but how can i get other associated values? In other words since [12, 4]
12 is the highest value but how can i get '4'?
*note after sorting the arrays from the first val, i would need access to all the values.