473,507 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

combining two multidimensional arrays

I have two array:

var Array1=new Array();

Array1[0]=[[''],['a'],['b']];
Array1[1]=[['x'],['y'],['z']];

var Array2=new Array();

Array2[0]=[['a'],['s'],['d']];
Array2[1]=[['1'],[2'],['3']];

What I'd like is to combine them so that I have a third array with all
the elements of both arrays.

Is there a good way to do this?

Jeff
Nov 8 '06 #1
1 1380
VK

Jeff wrote:
I have two array:

var Array1=new Array();

Array1[0]=[[''],['a'],['b']];
Array1[1]=[['x'],['y'],['z']];

var Array2=new Array();

Array2[0]=[['a'],['s'],['d']];
Array2[1]=[['1'],[2'],['3']];

What I'd like is to combine them so that I have a third array with all
the elements of both arrays.
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<script>
var Array1 = [
[
[''],['a'],['b']
],
[
['x'],['y'],['z']
]
];

var Array2 = new Array(Array1[0].slice(0), Array1[1].slice(0));

Array1[1][2] = 'Z';

alert(Array1[1][2]); // 'Z'

alert(Array2[1][2]); // 'z'

</script>
</head>

<body>

</body>
</html>

Nov 8 '06 #2

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

Similar topics

2
1137
by: Terry | last post by:
Hi, can someone plz tell me how multidimensional arrays (like a 2-D array) are stored in memory? Are they like single dimensional arrays? Stored sequentially in one "row", so to say? Thanks ...
9
6653
by: Charles Banas | last post by:
i've got an interesting peice of code i'm maintaining, and i'd like to get some opinions and comments on it, hopefully so i can gain some sort of insight as to why this works. at the top of the...
21
4152
by: utab | last post by:
Hi there, Is there a way to convert a double value to a string. I know that there is fcvt() but I think this function is not a part of the standard library. I want sth from the standard if...
9
4473
by: Slain | last post by:
I need to convert a an array to a multidimensional one. Since I need to wrok with existing code, I need to modify a declaration which looks like this In the .h file int *x; in a initialize...
0
7109
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...
0
7313
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7372
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...
0
7481
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5619
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,...
1
5039
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...
0
1537
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 ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
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...

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.