JavaScript
  Home arrow JavaScript arrow A Custom 2D JavaScript Array
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

A Custom 2D JavaScript Array
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-10-06

    Table of Contents:
  • A Custom 2D JavaScript Array
  • The Array Properties and Methods
  • Object Type Array with its Contents
  • Object Type Array Without Contents
  • The Constructor Function with a Number of Rows and Columns

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    A Custom 2D JavaScript Array


    (Page 1 of 5 )

    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.

    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.

    More JavaScript Articles
    More By Chrysanthus Forcha


     

    JAVASCRIPT ARTICLES

    - Comparing Fields and Customizing Error Messa...
    - Checking Numbers and File Extensions with jQ...
    - Validating Digits and Dates with jQuery`s Va...
    - Validating Ranges, Emails, and URLs with jQu...
    - More Uses for the jQuery Tooltip Plug-in`s b...
    - Building Image-Based Tooltips with the jQuer...
    - Using the jQuery Tooltip Plug-in`s bodyHandl...
    - Using Rangelength, Min and Max with the Vali...
    - Using Minlength and Maxlength with the Valid...
    - Modifying Tooltip Coordinates with the jQuer...
    - Applying a Fade Out Effect with the jQuery T...
    - Tracking Mouse Movements with the jQuery Too...
    - Checking Online Forms with the Validator jQu...
    - Nested JavaScript Functions as Objects
    - The jQuery Tooltip Plug-in







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek