Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript from method

/* The Array.from() method creates a new array
from an array-like or iterable object. */

// From a string
Array.from('hello'); // → [ "h", "e", "l", "l", "o" ]

// From arrow functions
Array.from([1, 2, 3], x => x + x); // → [2, 4, 6]

Array.from({length: 3}, (x="A", i) => x += i ); // → ["A0", "A1", "A2"]
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #javascript #method
ADD COMMENT
Topic
Name
8+7 =