Home arrow JavaScript arrow A Custom 2D JavaScript Array

A Custom 2D JavaScript Array

If you do not like the normal way of creating a two-dimensional array, for any particular reason, then this article is for you. Let me emphasize here that there's already a strong and growing need to make web pages active. So you need to start thinking about writing a custom two-dimensional JavaScript array. You will see how easy it is to do this.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 7
October 06, 2009
  1. · A Custom 2D JavaScript Array
  2. · The Array Properties and Methods
  3. · Object Type Array with its Contents
  4. · Object Type Array Without Contents
  5. · The Constructor Function with a Number of Rows and Columns

print this article

A Custom 2D JavaScript Array
(Page 1 of 5 )


You need basic knowledge of JavaScript Objects and JavaScript one-dimensional arrays to understand this series. You should also have general knowledge of arrays. In this two part series I show you how to create a custom two-dimensional array.

Rows and Columns

We shall create a two-dimensional array where the rows can be of different lengths. Most 2D arrays I have come across have rows that are all the same length. The developers of the Perl language have come up with a 2D array of different row lengths. In our custom array, let us meet this challenge.

Fig 1.1

The above table shows what we are talking about. The rows are of different lengths. They all begin from the left edge of the array table. With this array, you can talk about the height of the array, which is the number of rows.

But you can't talk about the width of the array, since the rows have different lengths. Note that the word "length" applies more to a one-dimensional quantity than to a two-dimensional one. You can talk about a maximum row length or even a minimum row length.

The rows of the array that we shall deal with in this series all begin from the left edge of the array table. The height of the array is the number of rows.

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-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials