I have a variety of variables with different values assigned to them, such as:
Weight_gain = 0.01 Weather_gain = 0.02
and many more like these. My goal is to determine the variable name with the highest assigned value.
When I attempt this using code, it only returns the numerical value, not the variable name.
var topNode = Math.max(Weight_gain,Smoking_gain,Exercising_gain,Foodhabits_gain,Parent_heartattack_gain,
Alcohol_gain,Occupation_gain,Workinghrs_gain);
Is there a way for me to retrieve the string representing the variable with the highest value, rather than just the value itself?