I’m trying to discover the best way of selecting an object that has the highest specific property value (in this case, number of wrong answers) and return another property (the name). E.G. the following object should return Mark:
[
{name: "Henry", age: "NYN", attempts: 3, wrong: 2},
{name: "Mark", age: "NNNY", attempts: 4, wrong: 3},
{name: "Beth", age: "", attempts: 0, wrong: 0},
{name: "Sally", age: "YYNY", attempts: 4, wrong: 1},
]
What’s the best way of going about this (in JavaScript)? Thanks for any help!