I have an array
a.value = [a,b,c,d,e,f]
How can I convert to comma seperated string like
a.value = "a,b,c,d,e,f"
Thanks for all help.
This question is related to
javascript
arrays
You can simply use JavaScripts join()
function for that. This would simply look like a.value.join(',')
. The output would be a string though.
Use the join
method from the Array type.
a.value = [a, b, c, d, e, f];
var stringValueYouWant = a.join();
The join
method will return a string that is the concatenation of all the array elements. It will use the first parameter you pass as a separator - if you don't use one, it will use the default separator, which is the comma.
Source: Stackoverflow.com