ECMAScript 6 supports a generic Array method for converting an array-like object into one of its own.It is Array.from(). This method is very useful while converting iterable objects to arrays, code will be much cleaner and no need to use split or slice hacks. It has the following syntax:

Array.from (arrayLike [ , mapfn [ , thisArg ] ] );

Parameters –
arrayLike – Required. An array-like object or an iterable object.
mapfn – Optional. A mapping function to call on each element in arrayLike.
thisArg – Optional. Specifies the this object in the mapping function.

The following example returns an array from a collection of DOM element nodes.

The following example returns an array of characters.

The following example returns an array of objects contained in the collection.

The following example shows the use of arrow syntax and a mapping function to change the value of elements.

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

Pavani
Pavani is a student of IT, a freelance web designer/developer and a tech writer. She deals with both front-end and back-end stuff. Whenever she is not in front of an Internet-enabled device he is probably reading a book.