I have an object like below and I want to output the first string element inside the array of arrays which is having the highest number, which is Australia in this case.
I have tried something like this below but it is not returning the expected, also it will not give the first element inside the array which is a string ["Australia", 127]
The final output must be simple text Australia after checking the data
let data = [
["Australia", 23],
["Australia", 127],
["England", 3],
["England", 71],
["Australia", 31],
["England", 22],
["Australia", 81]
];
let maxVals = data.map(function(a) {
return Math.max.apply(Math, a);
});
console.log(maxVals)