JavaScript Array from() method

Definition and usage

from() The method returns an Array object from any object that has a length property or is iterable.

Example

Create an array from a string:

var myArr = Array.from("ABCDEFG");

Try it yourself

Syntax

Array.from(object, mapFunction, thisValue)

Parameter value

Parameter Description
object Required. The object that needs to be converted to an array.
mapFunction Optional. The map function called for each item in the array.
thisValue Optional. The value used as this when executing mapFunction.

Technical details

Return value: Array object
JavaScript version: ECMAScript 6

Browser support

The numbers in the table indicate the first browser version that fully supports this method.

Chrome Edge Firefox Safari Opera
Chrome 45 Edge 12 Firefox 32 Safari 9 Opera 25
September 2015 July 2015 September 2014 September 2015 October 2014

Note:Internet Explorer does not support from() Methods.

Related Pages

Tutorial:JavaScript Array

Tutorial:JavaScript Array Const

Tutorial:JavaScript Array Methods

Tutorial:JavaScript Sort Array

Tutorial:JavaScript Array Iteration