Javascript array from() is an inbuilt function that creates a new, shallow-copied array instance from an array-like object or iterable object.

The Array .from() lets you develop Arrays from the array-like objects (objects with a length property and indexed items) or  iterable objects ( objects where you can get its items, such as Map and  Set).

The Array from() function was introduced in ECMAScript 2015.

Javascript Array From Example

Array.from() method in Javascript is used to creates a new  array instance from a given array. If you pass a  string to the Array.from() function, then, in that case, every alphabet of the string is converted to an element of the new array instance. In the case of integer values, a new array instance simply takes the elements of the given Array.

The syntax of the Array.from() method is the following.

Syntax

Array.from(arrayLike[, mapFn[, thisArg]])

#javascript #ecmascript #javascript array from #array.prototype.from

Javascript Array From Example | Array.prototype.from()
4.30 GEEK