JavaScript学习笔记2-数组对象

 <!DOCTYPE html>
 <html>
 <head lang="en">
     <meta charset="UTF-8">
     <title></title>
 </head>
 <body>
 <script>
     //合并数组
     var arr1 = ["Hello","World","PHP","Js"];
     var arr2 = ["name","age","sex","weight"];
     var arr3 = arr1.concat(arr2);//合并数组,arr1合并arr2
 //    document.write(arr3);
     //数组排序
     var na = [3,5,7,1,6,4,2];
     document.write(na.sort(function(a,b){
         return a-b;//升序
         return b-a;//降序
     }));
     //追加
     var yy = ["w","h"];
     yy.push("p");//追加字符p
     document.write(yy);
     //反转
     var tt = ["o","l","l","e","h"];
     document.write(tt.reverse());//反转数组
 </script>
 </body>
 </html>
上一篇:谷歌在荷兰设立数据中心事件深陷受贿门


下一篇:大数据学习笔记(三):HDFS分布式文件系统架构原理详解