javascript - How do I separate a comma delimited variable into multiple variables? -
this elementary, i'm still learning.
i've imported record xml file , have result :
"a,b,c,d,e,f,g,h"
i end 8 separate variables, 1 each comma delimited value.
shortest way code using javascript?
if .split() list, you'll end single array 'n' number of elements. not -exactly- 8 separate variables, 8 elements can accessed individually.
var mylist = "a,b,c,d,e,f,g,h"; var myarray = mylist.split( ',' ); alert( myarray[ 4 ] );
Comments
Post a Comment