JavaScript Array from()
Example
Create an Array from a String:
Array.from("ABCDEFG") // Returns [A,B,C,D,E,F,G]
Try it Yourself »
Definition and Usage
The from() method returns an Array object from any object with a length
property or any iterable object.
Browser Support
The numbers in the table specify the first browser version that fully supports the method:
| Chrome 45 | Edge 12 | Firefox 32 | Safari 9 | Opera 25 |
| Sep 2015 | Jul 2015 | Sep 2014 | Sep 2015 | Oct 2014 |
The from() method is not supported in Internet Explorer.
Syntax
Array.from(object, mapFunction, thisValue)
Parameter Values
| Parameter | Description |
|---|---|
| object | Required. The object to convert to an array |
| mapFunction | Optional. A map function to call on each item of the array |
| thisValue | Optional. A value to use as this when executing the mapFunction |
Technical Details
| Return Value: | An Array object |
|---|---|
| JavaScript Version: | ECMAScript 6 |

