Monday, May 20, 2024
147
rated 0 times [  150] [ 3]  / answers: 1 / hits: 58819  / 13 Years ago, fri, november 18, 2011, 12:00:00

Array A is a two dimensional array. It's made up of array X and Y. I'd like to add array Z to Array A as another item in Array A. How do I do this?



Edited to add code:



arrayA = new Array(
[1, 2, 3] //array x
[4, 5, 6] //array y
);

arrayZ = new Array(7, 8, 9);

//now, how do I add arrayZ onto the end of arrayA?

More From » multidimensional-array

 Answers
7

This will add it to the end of arrayA



arrayA.push(arrayZ);


Here's a reference for push: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/push


[#89035] Thursday, November 17, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kevonmoisesf

Total Points: 693
Total Questions: 101
Total Answers: 128

Location: Reunion
Member since Mon, Dec 28, 2020
3 Years ago
kevonmoisesf questions
Sat, Jan 23, 21, 00:00, 3 Years ago
Tue, Feb 18, 20, 00:00, 4 Years ago
Wed, Jun 12, 19, 00:00, 5 Years ago
;