I am currently tasked with the challenge of determining the minimum value from an array of objects that contain multiple keys. My ultimate goal is to identify the minimum value among all keys or specific keys within the objects.
For instance
var users = [
{id:"1", name:"ABC", age:30, height: 75, weight: 83},
{id:"1", name:"ABC", age:24, height: 63, weight: 75},
{id:"1", name:"ABC", age:27, height: 56, weight: 55}
]
In the given example, my aim is to locate the user(s) with the lowest age, height, and weight values, all using a single function.
The current function I have been utilizing only identifies the minimum age.
findMin(data) {
return data.reduce((min, u) => u.age < min ? u.age : min, data[0].age);
},