how to make array from string code example
Example 1: js string to array
str = 'How are you doing today?';
console.log(str.split(' '));
>> (5) ["How", "are", "you", "doing", "today?"]
Example 2: convert string to array javascript
let myArray = str.split(" ");
Example 3: turn array into string
const elements = ['Fire', 'Air', 'Water'];
console.log(elements.join());
// expected output: "Fire,Air,Water"
console.log(elements.join(''));
// expected output: "FireAirWater"
console.log(elements.join('-'));
// expected output: "Fire-Air-Water"