JavaScript array of arrays

In this Tutorial we want to describe you a code that help you in
understanding JavaScript array of arrays. For this we are using JavaScript as
Script language. We instantiate an array object by passing argument and object
of array to it and allocate them to the memory. The element in the array can be
accessed by its numerical index. Finally the document. write print the list
of element in an array.
javascriptArrayofArray.html
<html>
<head>
<title>JavaScript Array of Arrays</title>
</head>
<body>
<h1>JavaScript Array of Arrays</h1>
<script language="Javascript">
var array = new Array("Rose","India",564,375,new Array(5,6,7),".net")
document.write("array[0] = "+array[0]+"<br>")
document.write("array[1] = "+array[1]+"<br>")
document.write("array[2] = "+array[2]+"<br>")
document.write("array[3] = "+array[3]+"<br>")
document.write("array[4][0] = "+array[4][0]+"<br>")
document.write("array[4][1] = "+array[4][1]+"<br>")
document.write("array[4][2]= "+array[4][2]+"<br>")
document.write("array[5]= "+array[5]+"<br>")
</script>
</body>
</html>
|
Output of the program
Download source code

|