javascript - Push array to a collection of arrays -


i'm trying push array collection of arrays i'm getting unexpected results.

var itemx = ['a','b','c']; var itemy = ['x', 'y', 'z']; var itemlist = [];  itemlist.push(itemx); itemlist.push(itemy); 

i'm expecting this:

itemlist = [        ['a', 'b', 'c'],        ['x', 'y', 'z'] ] 

but instead i'm getting this:

itemlist = ['a', 'b', 'c', 'x', 'y', 'z'] 

am missing here? appreciated. thank much.

i think working fine, probable reason might trying alert itemlist; alerts a,b,c,x,y,z.

var itemx = ['a','b','c'];  var itemy = ['x', 'y', 'z'];  var itemlist = [];    itemlist.push(itemx);  itemlist.push(itemy);    alert(json.stringify(itemlist));


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -