<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
var arr = [];
for(var i=0;i<10;i++) {
arr.push(Math.round(Math.random()*(100-10)+10));
}
arr.sort(function (n1,n2) {
return n1-n2;
})
console.log(arr);
</script>
</body>
</html>
网友评论