Home arrow JavaScript arrow An in depth discussion of JavaScript Arrays

An in depth discussion of JavaScript Arrays

This series of articles mainly concentrates on working with JavaScript arrays. We shall start with the basics of JavaScript arrays and finally conclude with complex object based arrays in JavaScript. You can reuse these scripts to inject into server side controls easily (especially in .NET and Java).

Author Info:
By: Jagadish Chaterjee
Rating: 4 stars4 stars4 stars4 stars4 stars / 14
February 28, 2006
  1. · An in depth discussion of JavaScript Arrays
  2. · Working with single dimensional arrays: discussion
  3. · Working with two dimensional arrays
  4. · Working with two dimensional arrays: discussion
  5. · Another way to work with two dimensional arrays

print this article

An in depth discussion of JavaScript Arrays
(Page 1 of 5 )

All of the examples in this series can be directly tested, by simply copying and pasting the entire code (of each section) into any text file with the extension .HTM and opening it by using a browser.

Working with single dimensional arrays

Everyone knows that an array is nothing but a set of values (or data) stored sequentially in memory.  Different languages have different syntaxes for declaring and using arrays.  In this series, we mainly concentrate on the JavaScript language to work with arrays.

Now, let us try to develop a simple script (JavaScript) to declare and work with single dimensional arrays.  Have a look at the following code:

           <meta name=vs_targetSchema 
<script id="clientEventHandlersJS" language="javascript">
function Show()
      var myArray = new Array();
      myArray[0] = "Jag";
      myArray[1] = "Chat";
      myArray[2] = "Win";
      myArray[3] = "Dhan";
      for (var i = 0; i < myArray.length; i++) 
            document.write(myArray[i] + "<BR>");

Button1_onclick() {
      <form id="form1">
                  <input type="button" value="Show" id="Button1" 
name="Button1" onclick="return Button1_onclick()">

Actually, within the above code, the “meta” tag is not necessary.  As I developed the above code using Visual Studio.NET 2003 Enterprise Architect, it was automatically added to provide its full-featured mechanisms.  The explanation for the above code is given in the next section.

blog comments powered by Disqus

- Project Nashorn to Make Java, JavaScript Wor...
- JavaScript Virus Attacks Tumblr Blogs
- Google Releases Stable Dart Version, JavaScr...
- Khan Academy Unveils New JavaScript Learning...
- Accessing Nitro? There`s an App for That
- JQuery 2.0 Leaving Older IE Versions Behind
- Fastest JavaScript Engine Might Surprise You
- Microsoft Adjusting Chakra for IE 10
- Brendan Eich: We Don`t Need Google Native Cl...
- An Overview of JavaScript Statements
- An Overview of JavaScript Operators
- Overview of JavaScript Variables
- More of the Top jQuery Social Plugins
- The Top jQuery Social Plugins
- More of the Top jQuery Slider Plugins

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials