Array Declaration

In this Tutorial we want to describe you a code that helps you in Understanding Array Declaration.

Array Declaration

In this Tutorial we want to describe you a code that helps you in Understanding Array Declaration.

Array Declaration

Array Declaration

     

In this Tutorial we want to describe you a code that helps you in Understanding Array Declaration. For this we are using JavaScript as scripting language.On loading the page, the function display ( ) is invoked that include variable array, that is used to instantiate an array object. This array object hold the element specified by an array index from [0]-[3].The for loop return true and execute the script till the length of variable i is less than the array.length.Finally the document. write print the list of element that an array object hold.

Array Declaration.html


<html>
  <head>
  <title>Array Declaration</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <style>

  </style>
  <script>
  
  function display(){
  var array = new Array();
  array[0"Ajay";
  array[1"Bhanu";
  array[2"Komal";
  array[3"Rakesh";
  array[4"Santosh"
  array[5"Tanuj"
  document.write("<b>Element of the array are</b><br>");
  document.write("____________________<br>");
  
  for(i=0;i<array.length;i++){
  document.write("Element "+i+" : "+array[i]+"<br>");
  }
  }
  </script>
  </head>
  
  <body onload="display();">
  
  </body>
</html>
 

Output

Download code