Check out a free preview of the full Advanced JS Fundamentals to jQuery & Pure DOM Scripting course:
The "Summary" Lesson is part of the full, Advanced JS Fundamentals to jQuery & Pure DOM Scripting course featured in this preview video. Here's what you'd learn in this lesson:

Alexis summarizes his coverage of Data Types, Operators and Primitives and answers a few remaining audience questions.

Get Unlimited Access Now

Transcript from the "Summary" Lesson

[00:00:00]
>> [MUSIC]

[00:00:04]
>> Alexis Abril: So to summarize all of this, variables are put in a call object. This is our call object visual representation here in blue and we say var me. This is going to be assigned to our new object with the equals that's what it's going to set our pointer to our address in memory here is our new object then here me equals curly brace.

[00:00:25] Then if we have any attributes on this objects like age or have this be a new pointer, it's going to point to some other primitive in this case. This could be anything right now in this case it's a primitive number but this could be anything else and this is gonna be our flow of what points to what.

[00:00:45] We're gonna get into a few situations here, some really, really common situations like this. Where we have what we would describe as maybe unexpected behavior, but once you have an understanding of what is pointing to what, you would completely this makes sense. I completely expect this to work the way it does, so let's talk about this, why does this still point to justin at the end of this?

[00:01:12] So here we go, we have our initial construct me.name. This is our name object, I'm sorry, me was our object. This is our name object here, name pointer and we have a first point of pointing to a primitive string just in here. This is the first construct, we have our second pointer name is gonna point to this new object.

[00:01:36] And this is the weird parts, name = and then objects first, alexis what this really does in memory. If you think about what this does, remember if we're looking at name equals curly brace name alexis. The parser is gonna come to that curly brace first. It's going to create a new object that happens to have an identical construct to our earlier object and then we're just going to reassign that pointer,

[00:02:16]
>> Alexis Abril: This is a little bit different than what you would expect in like a C or a Java. I want to say C I'm really referring to C# not standard C. Because we would expect this to probably modify this object, but again since if you consider everything a pointer.

[00:02:32] All we're doing with the equals is resigning it to our new spot in memory or new objects we've allocated. So when you say me.name.first at the end of this, you'll still get justin. Does that make sense?
>> Alexis Abril: Cool, yes go for it.
>> Student: Firefox I've been running this, and every time I said me.name to name, it's sets name as a string with the object, like, type of placed in a string.

[00:03:10]
>> Alexis Abril: You're setting me.name to name. So you're setting, so you're doing this concert here and you're setting after name equals me.name.
>> Student: Yeah.
>> Alexis Abril: You do the reverse me.name equals name.
>> Student 2: When I do your name equals me.name and then I call a name, I get object to object and secured first not sure that's what he's written I do.

[00:03:37]
>> Alexis Abril: You're using Firefox a lot?
>> Student: I'm Chrome.
>> Student 2: Mine's in Chrome tho.
>> Alexis Abril: Gotcha.
>> Group: [CROSSTALK]
>> Student 2: Okay, so how do I access to your name.first.
>> Alexis Abril: Yes, you told me you name.first one of my so that's correct. If you say type of me, type of me is gonna return an object, if you say type of me.name, name is your return, if you say type of me.name.first, we're gonna get our string.

[00:04:21] If you say type of name what is name in return?
>> Student: Object.
>> Alexis Abril: In both instances before the obvious
>> Alexis Abril: Any queestions? Any other questions, yes, sorry?
>> Student: So the reason why you keep this is this is happening where you are using Firefox to read get drunk. Okay, so sorry about using a bad example here.

[00:04:51] The reason why this is happened, if you change this to something other than name, it should work. Like this was the, you just do foo and then foo equal something, it should work the problem is [CROSSTALK] window.name
>> Alexis Abril: Got you.
>> Student: There is a property like Windows have a name property that is almost certainly being typed coursed to a string.

[00:05:12] They want it to be a string So when you set name equals to this object here, or name equals to this object here, you just type Kersey here to string. And that's where you get the object, object, should change the sign, because of the first people there's no where.

[00:05:30] I've shown the slide nearly million times, no one's ever point that out, so thanks for.
>> Alexis Abril: Good catch.
>> Student: Good catch but hopefully that makes sense essentially this is a special property, this is a special variable essentially the name variable. So avoid setting it in just kinda global context.

[00:05:52]
>> Alexis Abril: We did this in no desk.
>> Student: Yet relates less no discussion and probably. You know he's a good catch.
>> Alexis Abril: In terms of the language this is how things operate in terms of running in a browser running in an environment where at the mercy of the environment.

[00:06:13] Good questions though, good catch.