I'm currently using a function to assign custom tags based on the highest value in a small dataset. The dataset is as follows:
const team = [
{ name: 'John Doe', maxScore: '2', finishes: ['105', '108'] },
{ name: 'Peter Pie', maxScore: '1', finishes: ['140'] }
]
I wanted to assign a Tag (antd) to the player with the most maxScore value. I used the following code for that:
const highestMaxScore = Math.max.apply(
Math,
team.map(function (t) {
return t.maxScore
})
)
This worked fine, but now I want to do the same thing with the finishes. The main problem, the values are listed within an array. I can't figure out to modify the earlier used code to get the result I want.
Help is appreciated!
finisheshas both low and high values.