how to split a string into an array in js code example
Example 1: string split javascript
var myString = "An,array,in,a,string,separated,by,a,comma";
var myArray = myString.split(",");
/*
*
* myArray :
* ['An', 'array', 'in', 'a', 'string', 'separated', 'by', 'a', 'comma']
*
*/
Example 2: string to array javascript
const string = "Hello!";
console.log([...string]); // ["H", "e", "l", "l", "o", "!"]