The toString() method can be used to convert an array into a string. It returs a result containing string and it will seperate the different elements in the array with commas.
var group = ['one','two','three','four'];
var conv = group.toString();
The same thing can also be done by valueOf() method in javascript.
var group = ['one','two','three','four'];
var conv = group.valueOf();
To convert comma seperated value to an array, split() method is used. It is used to seperate a string into array that contains substrings and also returns a new array.
Syntax:
var group = ['one','two','three','four'];
var conv = group.valueOf();
Seperator: It can contain a regular expression or a character to split the string.
Limit: It defines the number of splits
var group = ['one','two','three','four']
var conv = "one,two,three,four"
var groupArray = conv.split(",") //print groupArray[0] one.
0 Comment(s)