<html>
<head>
<title>数组</title>
<meta charset="UTF-8"/>
</head>
<body>
<script type="text/javascript">
function compare(vaule1,value2){ if(value1<value2){
return -1;} else if(value1>value2){ return 1;}
else{ return 0;}
} var values=[0,1,5,10,15];
values.sort(compare);
alert(values); </script>
</body></html>
1 回答

红颜莎娜
TA贡献1842条经验 获得超12个赞
-兄弟你拼错单词了。
function compare(vaule1,value2){ if(value1<value2){
一个是vaule1, 一个是value1
添加回答
举报
0/150
提交
取消