Transcript from the "new operator Q&A" Lesson
>> Will Sentance: All right, let's have fun. I'm not accepting this. I have clarifications. I'm clear that our functions, when treated like functions, by adding parens on the end of them, behave as functions. If they're treated like an object, use a creator.andrew. What would this return for? What would this evaluate to, Andrea?
>> Andrea: It's gonna be an object with Andrew.
>> Will Sentance: Well, but with me retrieving this. So here we've already for the Andrew property. So a user created .andrew, I'd be retrieving three, exactly. Okay, so let's have thumbs on that notion. It's weird. Part of it's is just I need more time to embrace it.
[00:00:41] So Andrew's got a thumb Katie's got a thumb, medium thumb, sort of like a thumb. Art is good to go, Lindsey has a medium thumb. Griffin has one. Griffin, will you kick us off?
>> Griffin: So if you were to use the user creator as a call back function, can you use that user creator object data in that function that you're using-
>> Will Sentance: You certainly can, but I'll just make this point.
>> Griffin: Yeah.
>> Will Sentance: That wouldn't standard practice.
>> Griffin: Yeah.
>> Will Sentance: Just cuz it's there, doesn't mean we use it. We use it for this one thing we're gonna talk about. It isn't standard practice to bundle them in that sense.
[00:01:14] They're functions, it is all fundamentally objects but they use as functions, okay? But we can store stuff here. We're gonna see in a moment, we're gonna store something here, something here. We are gonna store something here. All right, everyone got that? Okay, Griffin, go ahead.
>> Griffin: Again, with the memory, could you kind of, instead of using the backpack of the lexicon thing, could you-
>> Will Sentance: Lexical scope.
>> Griffin: [LAUGH] Yeah, could you store it into that function's object?
[00:02:05] It's hidden off. You're right, we said functions have a hidden square brackets quote, that's not this guy here. That's a really nice clarification by Griffin. This object definitely is not that scope property, do you remember that guy which held on to state? Live in date, okay. That's an interesting one, man.
[00:02:22] Definitely not. No, stop. Stop it. That's not allowed and doesn't, okay. Lindsay?
>> Lindsay: I don't know. I think I got lost somewhere, but what's the function in user creator right now?
>> Will Sentance: User creator was declared.
>> Lindsay: Maybe C, Mr. Pelting.
>> Will Sentance: We are going to see in a second, but user creator was declared as a function at the top right?
[00:02:47] Whenever you declare a function, by default, just by its' very nature, it's also an object. Okay, just declaring that. Talk me through what we did in line 1 there, Lindsey.
>> Lindsay: Declared the function. User creator.
>> Will Sentance: User creator. We're allowed to draw functions in a box like that?
>> Lindsay: Mm-hm.
>> Will Sentance: What do we do in a few lines down in let user1 =.
>> Lindsay: We declared a variable and assigned it. The whatever, the user creator will return.
>> Will Sentance: Great, go run that functionality. And I know I have to run the functionality, why?
>> Lindsay: The prens.
[00:03:43] You put something in me like an object, and now these start to become weird things to say. You put something in me like an object, I behave as an object. That is just how it is. Okay, Lindsay, so it is a function. Nothing has changed. But if I were to treat it like an object: usercreator and said usercreator.andrew=3, then, if I had to console log my usercreator, I'd still see the function.
[00:04:11] But if I had to console log my user creator with a special Chrome dev tool, down arrow, I would see the function, but also in the properties, I would see some other properties, and our andrew : 3. Okay, so this is not surface level, really. We're not gonna be doing this day-to-day, but it's there.