js convert string array to variable array code example
Example 1: javascript string to array
const str = 'Hello!';
const arr = Array.from(str);
//[ 'H', 'e', 'l', 'l', 'o', '!' ]
Example 2: 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" ]