<html>
<script language="JavaScript">
<!--
function displayElements(theArray)
{
for(i=0; i<theArray.length; i++)
{
document.write(" - ",theArray[i][1]," ");
document.write(theArray[i][0],"<br>");
}
}
shelf1 = new Array(["A",10],["B",25]);
document.write("Shelf 1 contains:<br>");
displayElements(shelf1);
shelf2 = new Array(["C",50],["D",3],["E",8]);
document.write("Shelf 2 contains:<br>");
displayElements(shelf2);
inventory = shelf1.concat(shelf2);
document.write("<br>The total inventory contains:<br>");
displayElements(inventory);
--></script>
</html>
|