js turn array into string code example
Example 1: javascript array to comma separated string
var colors = ["red", "blue", "green"];
var colorsCSV = colors.join(",");
Example 2: js array to string
var myArray = ['no','u'];
var myString = myArray.toString();
Example 3: .join in javascript
const elements = ['Sun', 'Earth', 'Moon'];
console.log(elements.join());
console.log(elements.join(''));
console.log(elements.join('-'));
Example 4: transform array to string js
const myArray = [1, 2, 3, 4, 5, 6];
console.log(a.join('/'));
const myArray = ['g', 'o', 'o', 'g', 'l', 'e'];
console.log(a.join(''));
const array1 = [1, 2, 'a', '1a'];
console.log(array1.toString());
Example 5: javascript join list of string
var myArray ['foo', 'bar', 'baz'];
myarray.join(':');
Example 6: array to string javascript
<array>.join(<splitting character(s)>);