Home arrow JavaScript arrow A Custom 2D JavaScript Array
JAVASCRIPT

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 / 1
October 06, 2009
TABLE OF CONTENTS:
  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
SEARCH DEVARTICLES

TOOLS YOU CAN USE

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

Introduction

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
JAVASCRIPT ARTICLES

- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks
- Dynamic jQuery Styling

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



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