这是我的代码,我从某个地方复制了这段代码以了解 Array。我对代码运行完美有一些问题,但我想知道在代码var ascendingArray = new Array(10);
中是什么意思,(10)
这条线在这里做employees = employees.concat(newEmployees);
什么意味着这条线是什么意思。谢谢
<html>
<head>
<title>Array</title>
<script type="text/javascript">
var employees = new Array();
employees[0]='d';
employees[1]='b';
var newEmployees = new Array();
newEmployees[0]='c';
newEmployees[1]='a';
var ascendingArray = new Array(10);
var decendingArray = new Array(10);
document.writeln('<h3>Employee Names:</h3>');
document.writeln('<br>List Of Employee:<br/>');
employees = employees.concat(newEmployees);
for(var i=0; i < employees.length; i++)
{
document.write("<ul><li>"+employees[i] + "</ul>");
}
ascendingArray=employees.sort();
decendingArray=ascendingArray.reverse();
document.writeln('<br>List of Employees in decending order:');
for(var i=0; i< decendingArray.length; i++)
{
document.write("<ul><li>" + decendingArray[i] + "</ul>");
}
</script>
</head>
<body>
</body>
</html>