Example 1 — String to Character Array
Turn a string into a real array of characters.
const chars = Array.from("Code");
console.log(chars);
// ["C", "o", "d", "e"]
console.log(Array.isArray(chars)); // true How It Works
- Iterable source. Strings yield one character at a time.
- Build a real Array. Each character becomes an element.
- Static call. You invoke
Array.from, not a method on the string. - Array methods ready. You can
map,filter, etc. on the result.

