Last Updated : 11 Jul, 2025
The JavaScript Array from() method returns an Array object from any object with a length property or an iterable object.
Syntax :Array.from(object, mapFunction, thisValue)Parameters:
It returns an array object or instance of an arrray.
Example 1: In this example, we will be using Array from() method to create an array from the string value.
JavaScript
// Creating array from input string
let myArr = Array.from(
"GeeksForGeeks");
// Display output
console.log(myArr);
[ 'G', 'e', 'e', 'k', 's', 'F', 'o', 'r', 'G', 'e', 'e', 'k', 's' ]
Example 2: In this example, we will be using Array from() method to create an array from the string value.
JavaScript
// Creating array form the given string
let myArr = Array.from("45878965412365");
// Display output
console.log(myArr);
[ '4', '5', '8', '7', '8', '9', '6', '5', '4', '1', '2', '3', '6', '5' ]
We have a complete list of Javascript Array methods, to check those please go through this Javascript Array Complete reference article.
Supported Browsers:RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4