加载中...

数组的排序


调试运行

<html>
<head>
<title>数组的排序(使用sort方法)</title>
</head>
<body>
<script language="javascript">
<!--
	souce = new Array(85,72,98,56,29,73,95);
	document.write("排序前的数组为: ");
	for(i=0;i<souce.length;i++){
		document.write(souce[i]," ");
	}
	souce.sort();
	document.write("<br>排序后的数组为: ");
	for(i=0;i<souce.length;i++){
		document.write(souce[i]," ");
	}
//-->
</script>
</body>
</html>

还没有评论.