I'm trying to render out the lowest value of three values in an array. It looks like this
const compareValues = [
companyResult.physicalAverage,
companyResult.stressAverage,
companyResult.developmentAverage,
];
const getLowestValue = (Math.min(...compareValues)); // returns 4.5 (which is correct)
return (
<div>
<p>{getLowestValue}</p> // HERE I want to render out the name (string) instead of 4.5
</div>
);
However, I want to name each property, i.e
companyResult.physicalAverage = "Physical Activity"
companyResult.stressAverage = "Stress",
companyResult.developmentAverage = "Personal Development"
I still want to return the lowest value with Math.min, but somehow return the 4.5 as a name. Anyone that has a clue on how?