Is there a way to separate array.toString() with a semicolon rather than commas?
array.toString()
Try using the join method in the array - array.join(";")
array.join(";")
Check out join () . It takes an argument for the delimiter.
alert(myArray.join(';'));
array.toString().replace(/,/g,';'); array.join(';');
var arrayAsString = array.toString(); var whatYouWant = arrayAsString.replace(/,/g, ';');
Although the default separator for the join () method is a comma (','), you can also use other separators. Refer to the JavaScript Array Object: join () Method tutorial .