Friday, 15 February 2013

javascript - How to use array variable in array? -



javascript - How to use array variable in array? -

i have array , want set same array , other array within of first array.

var arr=["a","b","c",arr,arr2]; var arr2=["a","b"]; var arr3=[]; arr3=arr[3];

when print out arr, can see ["a","b","c",,]

but if print out arr3, result undefined.

how can prepare it?

you need in right order:

var arr1 = []; var arr2 = [ "a", "b" ]; // arr1 , arr2 defined can throw them array: var arr3 = [ "a", "b", "c", arr1, arr2 ];

javascript arrays

No comments:

Post a Comment