Array.from in JavaScript
Level 248 keystrokes
Array.from() creates a new array from an array-like or iterable object.
JavaScript code
// Array.from() converts iterables to arrays// A string is iterable, so it can be converted1let arr = Array.from("hello");// Each character becomes an array element// Result: ["h", "e", "l", "l", "o"]2console.log(arr);Output
[ 'h', 'e', 'l', 'l', 'o' ]
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this JavaScript code and how often they appear.
;× 2.× 2"× 2(× 2)× 2=× 1