标签:ack for .so color rip 数组 sort charset utf-8
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>数组排序</title> 6 <script> 7 var arr=[13,12,29,83,4,54]; 8 9 //方法一: 10 arr.sort(); 11 12 //方法二 13 var num=0; 14 for(var i=0;i<arr.length;i++){ 15 for(var j=i+1;j<arr.length;j++){ 16 if(arr[i]>arr[j]){ 17 num=arr[i]; 18 arr[i]=arr[j]; 19 arr[j]=num; 20 } 21 } 22 document.write(i+":"+arr+"<br>"); 23 } 24 </script> 25 </head> 26 <body> 27 </body> 28 </html>
标签:ack for .so color rip 数组 sort charset utf-8
原文地址:http://www.cnblogs.com/miaoxiaojiao/p/7040976.html