<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<script type="text/javascript">
var arr = [6,8,45,2,3,88,4];
arr.sort(function(a,b){return a>b?1:-1});//从小到大排序
alert(arr)
</script>
</head>
<body>
</body>
</html>
希望可以帮到你
|