Transcript from the "Array.from" Lesson
>> Bianca Gandolfo: Remember, we had to do that Array.prototype.slice.call? Now, in ES6, we have this handy thing called Array.from, which does exactly what we need it to do. It's gonna turn that arguments, pseudo-array into an actual array. And the reason, again, that we are doing that is cuz we wanna have access to this push method and this join method.
>> Bianca Gandolfo: How do we feel about Array.from? Are we happy about it? It's a lot less words to memorize. And also, I think whenever people see the word prototype, it just freaks everyone out. So I try to avoid saying prototype as much as I can in my courses, even if I'm talking about prototype, just because it's a scary word.
>> Speaker 2: So from does the exact same thing?
>> Bianca Gandolfo: Mm-hm.
>> Bianca Gandolfo: And then, it does more, it has a lot of features. It takes Iterables, and it makes it, it gives them access to array methods. But we don't need go into all that, we're just going to worry about the arguments.
[00:01:10] And then, from now until lunch, and over lunch, we're gonna implement our own from. So before from existed as part of the ES6 spec, we had to use methods like from(), that essentially did the Array.prototype.call, that slice.call, under the hood for us, without us having to think about it every time, right?
[00:01:36] That's the magic of using these utility methods is that, the things that we need to keep in our head, it minimizes them and also stops you from wasting time saying, prototype.call.slice, instead of slice.call or whatever, small mistakes you may make, when you have to type those things over and over and over again.
>> Speaker 3: So this is from the, this is _.is from() ES6 and not, no, it's from the _library?
>> Bianca Gandolfo: Yeah, underscore, low dash, it's part of a lot of functional libraries.
>> Speaker 3: But this, from this _.from() from the _library accomplish the same thing as the prototype method?
>> Bianca Gandolfo: Mm-hm, intense