js convert string to array with value at first place code example
Example 1: javascript turn string into array
var fruits = 'apple, orange, pear, banana, raspberry, peach';
var ar = fruits.split(', '); // split string on comma space
console.log( ar );
// [ "apple", "orange", "pear", "banana", "raspberry", "peach" ]
Example 2: convert string to array javascript
let myArray = str.split(" ");