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?
Similar Posts
- Join array items and convert to string in javascript
- Convert a Number or Integer to String in Javascript
- Convert a String to Number or Integer in Javascript
- Convert all characters to lowercase using toLowerCase() method in javascript
- Convert object {key: value} to Array [[key, value]] Javascript
- Convert String to JSON Data
- Convert JSON data to String