Array.from() lets you convert an "iterable" object (AKA an array-like object) to an array. In this lesson, we go over grabbing DOM nodes and turing them into an array so that we can use methods like
Array.forEach() on them.
Some more background.
HTMLCollection, etc. are both Iterable (they implement
[Symbol.iterator] on their prototype, and ArrayLike (they have an integer length property). The cool thing about
Array.from is that is handles both cases, so anything that you might previously have done
.slice.call(ArrayLike) on is covered, as are Iterables (the result of generators, along with
It turns out that most ArrayLike objects (such as
arguments) are also Iterable in ES6, and projects are following suit (e.g. jQuery returns Iterable collections now).