I have an array with multiple arrays of objects and Im trying to find the object with the highest value.
values = [
[ {_: "NAN", id: 1},
{_: "NAN", id: 2},
{_: "NAN", id: 3}
],
[{_: "3.006", id: 4},
{_: "7.206", id: 5},
{_: "1.906", id: 6}
],
[{_: "3.226", id: 7},
{_: "2.222", id: 8}
{_: "2.224", id: 9}
],
[{_: "0.006", id: 10},
{_: "0.321", id: 11},
{_: "0.938", id: 12}
]]
i tried to use .map and .find
var a = Math.max(...values.map(e => e._))
const highestPoint = values.find(values => values._ === a)
But its only bringing back NAN as highest point const highestPoint = {_: "NAN", id: 1}, like its only looking through the first array?