Check out a free preview of the full JavaScript: From Fundamentals to Functional JS, v2 course:
The "_.from() Exercise" Lesson is part of the full, JavaScript: From Fundamentals to Functional JS, v2 course featured in this preview video. Here's what you'd learn in this lesson:

In this exercise, students implement _.from() function. Bianca takes questions from students.

Get Unlimited Access Now

Transcript from the "_.from() Exercise" Lesson

[00:00:00]
>> So yeah, so we're gonna implement this. In this case, we gonna pass the array. Just so you know. And we're gonna implement the internals of from or so. You have a question?
>> Yeah, so the array like objects that it's receiving, can you just say more about what that is supposed to be at least for this exercise or like should I return-

[00:00:28]
>> Make sure you return an array. I should take an array like object and return an array. An array like object is just an object that has numerical indices but it doesn't have array methods in it.
>> Okay, I think it's huge, I mean that.
>> Yeah, it actually even has a length, so be careful.

[00:00:48] But it won't have a push.
>> Okay.
>> That's what it will look like visually. Good question.
>> Okay, got it, thank you. And if you do, let's try something here, I'm curious. I wanna show you a cool trick, you ready? So did you know you can just put a debugger here?

[00:01:25] Did you guys know that? And then you run it and it just opens your random code snippet in the debugger. So I put a debugger here because I wanna stop the function right there so I can have access to arguments. So here's what the arguments, Looks like. And if we say array, that is array.

[00:01:50] Arguments should return false. Can you guys see that? It's so small. So all I did was took a code snippet, I put a debugger in there, it passes it here. And the reason I wanna passes it there is because it's after it's been invoked, add the arguments, Variable has a value at that point.

[00:02:13] So if you wanna experiment with your code, you can do that. And for those of you who aren't familiar with how this works, you can step over your code as well. And you can also step into methods. So if you define a method, you can step into it and it will jump into that file or to that method definition.

[00:02:35] And then you can keep walking through and you can follow how your code runs in your project. So that's kinda nice. And if you go too far in you can step out as well. But most of the time, I'm just stepping over things. And then it will tell me, for example, that array looks like that.

[00:03:00] I'm not gonna hover, which is pretty nice. Also if I go too far, I can look at the call stack and I can do something called restart stack frame. And it will go back to the beginning and then I can do it again. Just be like wait, what happened?

[00:03:14] Okay, that's what happened. And then I forgot again and I restarted. Or whatever. That's another cool thing. You can watch variables if you want. It's not as useful as it used to be now that we can hover and it has these little orange things now. You can see different scopes, which will be useful, after lunch we're gonna talk about scope.

[00:03:40] So in our global scope, it looks like we have a lot of different, Libraries here with a bunch of craziness. And then locally we have our arguments, our array and the window. I'm not sure what, I guess the script scope is just the scope of this little snippet that I passed in.