Home Java Javascript-array Array Declaration



Array Declaration
Posted on: November 11, 2008 at 12:00 AM
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. 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

Related Tags for Array Declaration:
javajavascriptcarrayscriptingantfunctionscriptobjectlanguagefunioincludehelploadvariableseddisplayippagetutorialusingriathisdeclarationloadinginvokeforunctolanedessplvaruseinasstantplaypswanjispadclesfuncageobjdescribetorsspatratiokincisinstantinstantiateharayandarcodcodeunderstandingwantvatutorscrssriripthavstabablatiantihatdispecljeplndodeono


More Tutorials from this section

Ask Questions?    Discuss: Array Declaration  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.