This is my code i have copied this code from somewhere to learn about Array. i have some problem with that the code is working perfect but i want to know that
in code var ascendingArray = new Array(10);what is mean by (10) and what is this line doing here employees = employees.concat(newEmployees); means what is mean by this line.
Thanks
<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>
with
you can give the array an initial size of 10.
means: put the two arrays together to one single array