Widely available Supported across all major browsers. Safe to use in production.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
45
12
32
9
45
9
Built-in object

The TypedArray.from() static method creates a new typed array from an array-like or iterable object. This method is nearly the same as Array.from().

45
12
38
10
45
10
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)

Syntax

JAVASCRIPT
// NodeList → Array
const divs = Array.from(document.querySelectorAll('div'));

// String → Character array
Array.from('Hello'); // ['H', 'e', 'l', 'l', 'o']

// With mapping
Array.from({ length: 5 }, (_, i) => i * 2);
// [0, 2, 4, 6, 8]

Live demo

String from array generate

String. eachcharacter element to hasarray generate..

PreviewFullscreen

Set from array generate

Duplicates. Set object array to convert..

PreviewFullscreen

mappingfunction use

generate and simultaneous to eachelement (example: index to generate)..

PreviewFullscreen

Use cases

  • Using Array.from()

    The Array.

Cautions

  • No specific concerns. Stable across all major browsers.

Accessibility

  • When updating the DOM dynamically, announce important changes to assistive technology with aria-live regions.