JavaScript array element to string -


i have simple array , want generate string include elements of array, example:

the array set follow:

array[0] = uri0 array[1] = uri1 array[2] = uri2 

and output string must

teststring = uri0,uri1,uri2 

i've tried make following way (using loop):

var teststring = ""; teststring = teststring+array[y] 

but in firebug console see error message:

"teststring not defined" 

i don't know, i'm doing wrong. can give me hint?

you must use join function on array:

var teststring = array.join(","); 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -