Search code snippets, questions, articles...

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"]
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool
Output
["H","e","l","l","o"]
Was this helpful?
0 Comments