【发布时间】:2012-12-18 20:35:05
【问题描述】:
所以我使用 JavaScript 并且我有一个变量数组。
var a=5,b=10,c=3,d=11,e=0; //5 Variables with randomly chosen values
var myArray=[a,b,c,d,e];
myArray.sort(); //sort them, so the lowest value or variable is on first place
alert("This Variable has the lowest value: " + myArray[0]);
//tell me the variable with the lowest value
所以基本上,我会得到这样的文本:“This Variable has the minimum value: 0”
但我想要的是:“这个变量的值最低:e”
如何返回变量而不是变量的值?
最好的问候 qweret
【问题讨论】:
-
检查这个线程,它包含答案link
标签: javascript arrays variables sorting return