I have an object that looks like this:
const yo = {
one: {
value: 0,
mission: 17},
two: {
value: 18,
mission: 3},
three: {
value: -2,
mission: 4},
}
I want to find the minimum value of the mission prop within the nested objects. This line works to find the minimum value of the nested value prop and returns -2:
const total = Object.values(yo).reduce((t, {value}) => Math.min(t, value), 0)
But when I try the same thing for the mission prop, it returns 0 when it should be 3:
const total = Object.values(yo).reduce((t, {mission}) => Math.min(t, mission), 0)
Is there something that I am missing or doing wrong?