Home Java Javascript-array Array Definition



Array Definition
Posted on: November 11, 2008 at 12:00 AM
This Tutorial illustrates an code example that makes you easy to understand the code in Array Definition. On loading a page, display ( ) function is invoked.

Array Definition

     

This Tutorial illustrates an code example that makes you easy to understand the code in Array Definition. On loading a page, display ( ) function is invoked. The function display ( ) includes an array variable, used to instantiate an array object. An array object hold the list of different element varying from [0]-[5].The document. write print the Element of the array are followed by line breaker. The for loop executes the script till the length i is less than array length. Finally the document. write print the name of element that an array object hold.

 

 

 

 

Array Definition.html


<html>
  <head>
  <title>Array Definition</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <script>
  function display(){
  var array = new Array();
  array[0"One";
  array[1"Two";
  array[2"Three";
  array[3"Four";
  array[4"Five"
  array[5"Six"
  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 Definition:
cooparraylistantfunctionscriptobjectdifffunioincludemakeloadvariablesedprintloopdisplayippageexectutorialdefinitionnameintlineriathisloadingwritelengthelementinvokeexeooincludesifforexampleexecuteuncfinaltoinibreakexamfinallyldeilitdocdesliinitsplvarusefromindifferentasstamntplaytrlessjispadclesemfuncallagemeobjrateratesdocuttorxaxampsxespessatoldkincisinstantinstantiatehallmplrayfolloweaandarcodcodestrvavaryvaryingtutorscrssririprenthstabablantihatdispfefinjepleplprndodeonomolo


More Tutorials from this section

Ask Questions?    Discuss: Array Definition  

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.