convert array to string javascript code example

Example 1: jquery convert a string to an array

var numbersString = "1,2,3,4,5,6";
var numbersArray = numbersString.split(',');

Example 2: js array to string

var myArray = ['no','u'];
var myString = myArray.toString();

Example 3: javascript convert in a string the items of an array

const arr = [1, 2, 'a', '1a'];
const str = arr.toString();
console.log(str); //> "1,2,a,1a"

Example 4: print whole array javascript

print whole array on one line without brackets javascript

Example 5: array to string js

array.join("").toString()

Example 6: array to string javascript

var cars = ["Volvo", "BMW", "Audi", "Chevrolet"];
console.log(cars.toString());
//Output: Volvo,BMW,Audi,Chevrolet