Skip to main content

Calling the Array Function

In order to use the array, we have to call it somewhere. In this page, it is called in the body. This is done as shown below by calling CreateMultiArray() in some JavaScript tags.

<script type="text/javascript">
<!-- Begin hiding.
/* You need to build the array, so this is essential*/
//Populate the text area to show the contents of the array
var s='';
for (i=0;i<5; i++) {
for (j=0;j<2; j++) {
s=s+'Array['+i+', '+j+']:= '+'\"'+MultiArray[i][j]+'\" ';
}//end of for i=0;i<n; i++
}//end of for i=0;i<n; i++
// End hiding. -->

The example shows all the values of the array in a text area in the form above. The code which follows CreateMultiArray() is how the text area is populated. In this, we simple call each element and add it to the text area.

Next: Control Structures