text to array javascript code example
Example 1: string to array javascript
const str = 'Hello!';
console.log(Array.from(str));
Example 2: javascript split string
const path = "/usr/home/chucknorris"
let result = path.split("/")
console.log(result)
let username = result[3]
console.log(username)
Example 3: convert a string to array in javascript
str = 'How are you doing today?';
console.log(str.split(" "));
Example 4: javascript text to array
var str = "How are you doing today?";
var res = str.split(" ");