S
SM
Hello
I'm trying to create a multi dimensional array in JavaScript, but
after some reading i still can't figure out how to apply it to my
model.
Here it is:
I have a list A and for each item in the list A i want to associate an
undetermined number of items. The complication for me is the fact that
the items to associate in list A are undetermined.
ie
LIST A
----------------
News
Entertainment
Politics
Items to associate
---------------------
News ---> Internacional, Asia, Europe,
Entertainment ---> Showbizz, Events
Politics ---> Local
i guess i can transalate it like this:
listA[0][0] = (News, Internacional);
listA[0][1] = (News, Asia) ;
listA[0][2] = (News, Europe);
listA[1][0] = (Entertainment, Showbizz);
listA[1][1] = (Entertainment, Events);
listA[2][1] = (Politics, Local);
I then would like to iterate through the array using a FOR statment
for(i=0; .... ; i++)
{
for(j=0; ...; j++)
{
...
}
}
How do i create this model using Javascript?
Thanks
Marco
I'm trying to create a multi dimensional array in JavaScript, but
after some reading i still can't figure out how to apply it to my
model.
Here it is:
I have a list A and for each item in the list A i want to associate an
undetermined number of items. The complication for me is the fact that
the items to associate in list A are undetermined.
ie
LIST A
----------------
News
Entertainment
Politics
Items to associate
---------------------
News ---> Internacional, Asia, Europe,
Entertainment ---> Showbizz, Events
Politics ---> Local
i guess i can transalate it like this:
listA[0][0] = (News, Internacional);
listA[0][1] = (News, Asia) ;
listA[0][2] = (News, Europe);
listA[1][0] = (Entertainment, Showbizz);
listA[1][1] = (Entertainment, Events);
listA[2][1] = (Politics, Local);
I then would like to iterate through the array using a FOR statment
for(i=0; .... ; i++)
{
for(j=0; ...; j++)
{
...
}
}
How do i create this model using Javascript?
Thanks
Marco