js 数组排序 sort()
<script>
function randomsort(a, b) {
return Math.random()>.5 ? -1 : 1;
}
var arr = [0,1,2,3,4,5,6];
var arr2 = arr.sort(randomsort);
alert(arr2);
</script>
<script>
function randomsort(a, b) {
return Math.random()>.5 ? -1 : 1;
}
var arr = [0,1,2,3,4,5,6];
var arr2 = arr.sort(randomsort);
alert(arr2);
</script>