Home Java Javascript-array JavaScript Array get key



JavaScript Array get key
Posted on: November 10, 2008 at 12:00 AM
In this Tutorial we want to describe you a code that help you in understanding JavaScript Array get key.

JavaScript Array get key

     

In this Tutorial we want to describe you a code that help you in understanding JavaScript Array get key. For this we implement JavaScript as Scripting language. We have taken an array that creates and initializes an associative array including different three elements. The elements in this array  are addressed using the key strings("R", "I", and "N") instead of an array element number (0, 1, or 2). In the example given below ,array["R"] returns you "ROSE". This provides you to create and use arrays with more different addresses schemas.. The given below code uses for loop to iterate this array..

 

 

 

 

JavaScript_Array_get_key.html

<html>
  <head>
  <h1>JavaScript Array get key</h1>  
  <title>JavaScript Array get key</title>
  </head>
  <body>
  <script language="javascript" type="text/javascript">
  array = {"R" "ROSE""I" "INDIA",".N":".NET" };
  for (key in array)
  document.write("For the Element " "<b>"+array[key]+"</b>" 
  " Key value is  " +"<b>"+key+"</b>"+"<br>");  
  </script>
  
  </body>
</html>

Output of the program

Download Source code

Related Tags for JavaScript Array get key:
javajavascriptcarrayscriptingantscriptdifflanguagehelpgetiptutorialkeyriathisssoelementcreateelementsiffortoinicilaneitdesociliinitinitializeimassociativeindifferentasstamntwanjclesemagemehrdescribetorssoeeatkincishaivmplrayeaandarcodcodesocunderstandingwantvatutorzscrssririprenthavstatihatfeinitialpleplndodeo


More Tutorials from this section

Ask Questions?    Discuss: JavaScript Array get key   View All Comments

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.