Skip to content

Glossary: Data Structures and Algorithms in JavaScript

Array.from

Also written: Array.from({ length: n }, fn)

A built-in that builds an array of `n` items by calling a function for each position, as in `Array.from({ length: n }, fn)`. It is handy for making test data, such as an array of order IDs from 1 to 1,000,000.

Where the book teaches it

Related terms

Array