首页 > 代码库 > Array数组对象

Array数组对象

1.数组方法:

技术分享

1>字符串的连接:

var myarr1= new Array("010")
var myarr2= new Array("-","84697581");
ducument.write(myarr1.concat(myarr2));

2>字符串的排序:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Array对象 </title>
<script type="text/javascript">
   function sortNum(a,b) {
       return b - a;
   }
var myarr = new Array("80","16","50","6","100","1");
document.write(myarr.sort(sortNum);
</script>
</head>
<body>
</body>
</html>

 

Array数组对象