473,385 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Declaring a two-dimesional array in javascript

Hi to all,
I have this problem in declaring a two-dimesional
array, how will i declare such array with unknown number of rows?

Your help will be very much appreciated. Thanks in advance.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #1
5 10404
Lee
ms_chika said:

Hi to all,
I have this problem in declaring a two-dimesional
array, how will i declare such array with unknown number of rows?

Your help will be very much appreciated. Thanks in advance.


Javascript doesn't support two-dimensional arrays, but on the other
hand, you don't need to declare the number of elements in an array,
either.

var myArray=new Array();
myArray[237]=new Array();
myArray[237][12]="Hello, world!";

Jul 23 '05 #2
oh i see, how about this one ,another question. I have 3
two-dimensional array, i want to merge these 3 arrays so that it will
become only 1 two-dimensional array. Is it possible? If it is, how will
i dot that?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3
ms_chika wrote:
oh i see, how about this one ,another question. I have 3
two-dimensional array, i want to merge these 3 arrays so that it will
become only 1 two-dimensional array. Is it possible? If it is, how
will i dot that?


Have you tried something like:

j=target_array.length;
for (var i=0; i<source_array.length; i++) {
target_array[j] = source_array[i];
j++;
}

?
HTH
Markus
Jul 23 '05 #4
ms_chika wrote:
Hi to all,
I have this problem in declaring a two-dimesional
array, how will i declare such array with unknown number of rows?

Your help will be very much appreciated. Thanks in advance.


var prem=
[["Arsenal",12,3,2],["Chelsea",12,5,0],["Fulham",6,6,6],["Tottenham",4,4,8]];

prem[1][0] =="Chelsea" //true

Mick
Jul 23 '05 #5
Thanks a lot, i got it. =)

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Stefanie | last post by:
Hi, I have a question about declaring variables for writing data to a file for random access. I have two string variables declared in a module (user-defined types). The point is that for one of...
1
by: Maarten Terlingen | last post by:
Sample: ClassA: ClassB ClassB: ClassC ClassA x = new Class C I want to know the declaring type of C. x.GetType() returns C x.GetType().BaseType returns B x.GetType().BaseType.BaseType...
20
by: Ole Hanson | last post by:
I am accessing my database through an interface, to allow future substitution of the physical datastore - hence I would like to declare in my Interface that my DAL-objects implementing the...
5
by: param | last post by:
Declaring struct as static is creating problem with newer version of CC compiler 5.7 in solaris. e.g. static struct new_str { int a; int b; };
3
by: jbeteta | last post by:
Hello, I have a problem declaring variables. I need to create an object oRpte as ReportClass on WebForm1.aspx and be able to use its value on WebForm2.aspx. For declaring the property oRpte()...
24
by: Daniel Rudy | last post by:
Hello Group, Consider the following code: /* form 1 */ int main(void) { int i; char *p;
11
by: Jim Michaels | last post by:
friend fraction& operator+=(const fraction& rhs); fraction.h(64) Error: error: 'fraction& operator+=(const fraction&)' must take exactly two arguments I practically pulled this out of a C++...
8
by: SM | last post by:
I've always wonder if there is diference when declaring and initializing a varible inside/outside a loop. What's a better practice? Declaring and initializing variables inside a loop routine,...
8
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using vs2005, .net 2, C# for Windows application. I use DllImport so I can call up a function written in C++ as unmanaged code and compiled as a dll us vs2005. My application is able to...
5
by: Markus Pitha | last post by:
Hello, I have a class "Menu". In this class I declare an object "Controller". Now I have a problem: Controller uses a ctor but I get the value I have to pass later in my program. The only way...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.