array from string javascript code example
Example 1: javascript explode
var str = "Well, how, are , we , doing, today";
var res = str.split(",");
Example 2: js array to string
var myArray = ['no','u'];
var myString = myArray.toString();
Example 3: string split javascript
var myString = "An,array,in,a,string,separated,by,a,comma";
var myArray = myString.split(",");
Example 4: string to array javascript
const str = 'Hello!';
console.log(Array.from(str));
Example 5: string to array javascript
const stringToSplit = '01-02-2020';
console.log(stringToSplit.split('-'));
const stringToSplit = '01-02-2020';
console.log(Array.from(stringToSplit));
Example 6: array to string javascript
var cars = ["Volvo", "BMW", "Audi", "Chevrolet"];
console.log(cars.toString());