I have players
containing multiple objects within. My end goal is to return the name
property of the object with the highest points
value.
For example this block should return a string of Bob
const players = [
{
name: 'Jack',
points: 3
}
{
name: 'Jill',
points: 2
}
{
name: 'Bob',
points: 4
}
]
for(i = 0; i < players.length; i++){
// return string of name property of object with highest value in points
}
I'm not sure how to execute this inside the for loop