Click here to Skip to main content
15,917,991 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am trying to create 2D array in JavaScript to store some Database values, here is my code

function fillArrays(ImageSmall, ImageBig, Title, DealId, Description) {

       var array_Data = new Array(ImageSmall, ImageBig, Title, DealId, Description);

       array_Obj[array_Obj.length - 1] = array_Data; //var array_Obj= new Array() its written //above
       var obj = array_Obj[0];
       //        alert(??);

Arrays are being created Fine, i am having problem extracting data from the inner Array i.e "array_Data" which have values of "ImageSmall, ImageBig, Title, DealId, Description" in it.

i was trying like this before
alert (array_Obj[0][0]);  // not working for me
var obj= array_Obj[0];
alert (obj[0]); // not working too for me. 

I'll Appreciate any help.

1 solution

You almost there :-)
array_Obj[array_Obj.length - 1] = array_Data; 

array_Obj[array_Obj.length] = array_Data; 

check this Demo[^]
Share this answer
SohaibX 12-Jun-14 2:17am    
Thanks man. I really need a cup of tea :P

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900