JavaScript array index of

javascript array index of

JavaScript array index of 

In this Tutorial we want to describe that makes you to easy to understand JavaScript array index of. We are using JavaScript as scripting language. An array var instantiate array object that hold the values of an elements. The document. write print the Element in the array are followed by break line. The for loop execute the script till variable  i is less than the length of an array. The document. write print the value of element that an array object hold specified by [0]-[3] array indexing followed by break line.

1)index of( )  - This return the position of the value that is hold by an array object and store in a variable index.

Finally the document. write print the index position of India on array.


  <head><h1>JavaScript Array indexof </h1>
  <title>JavaScript array indexof </title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <script language="javascript" type="text/javascript">
  var array=new Array();
  document.write("<b>"+"Element in the array are "+"</b>""<br />");
  document.write("=================""<br />");
  for(var i=0;i<array.length;i++){
  document.write("=================""<br />");
  var index = array.indexOf("India");
  document.write("<b>"+"Index of India on the array is: "+"</b>"+index);

Output of the program

Download Source code

Share on Google+Share on Google+

JavaScript array index of

Posted on: April 17, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles



Discuss: JavaScript array index of  

Post your Comment

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