473,809 Members | 2,876 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 10423
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
6342
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 them i can't define (hard coded) a fixed length because the application is reading data from another file (In that file they have the same lenght). Is it possible to use the lenght i obtain from reading that other file to declare my variable or...
1
2868
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 returns A, but I don't know the depth in my
20
4266
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 interface and accessing the datastore MUST pass in a UserToken in the constructor of the object. Is this not possible? Am I forced to add the UserToken as a property on the object instead? /Ole
5
2234
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
2272
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() on WebForm1.aspx, I use "Public Property" and I declare variable _oRpte as Friend Shared. That's my problem. If I don't declare _oRpte as Friend Shared, I can't use WebForm1.oRpte() on other webpage. If I declare _oRpte as Friend Shared, I can use...
24
1902
by: Daniel Rudy | last post by:
Hello Group, Consider the following code: /* form 1 */ int main(void) { int i; char *p;
11
4762
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++ book (except for the "friend"). can someone explain why GCC is giving me problems here? for a += or similar operator, what does a proper declaration look like and what are its arguments for?
8
7524
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, like this: for(var i=0; i<list; i++) { var name = list; }
8
2937
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 call the function, EncodeAsnUser. And it's returning OK but when I display the decoded data in another part of my application it shows no data has been decoded, all fiedls are either null or blanks. For some reason, I am not able to step through...
5
1792
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 to solve this is to make a new instance of "Controller" and use it dynamically, but how can I use it as static object? class Menu {
0
9600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10375
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9198
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3860
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.