javascript

Convert a string to array using Array.from() in javascript

We can convert a string to an array using Array.from() method in javascript. It will generate an array from string characters convert to array items.

const str = "Hello";

const arr = Array.from(str);
console.log(arr);
// -> ["H","e","l","l","o"]
Output
["H","e","l","l","o"]
Was this helpful?