Transcript from the "Object dot Notations" Lesson
>> Will Sentance: What is another way that we might go about creating objects? Well, the first one we saw there was just what's called an object literal. Let's just remind ourselves that we can also create an object, empty object, and then assign its properties with dot notation. We're gonna do this again, and again, and again today.
[00:00:40] So tell me what we're doing here in line one, Michael.
>> Michael: So we're creating a const called user two in memory.
>> Will Sentance: In memory, so I'm gonna mark up this area of my whiteboard to be, with my brand new pens, to be our memory. And the first thing, spot on, Michael, what is User2, which is a const, a constant, that means we can't switch the whole object out.
[00:01:04] We can change properties, but we can't get rid of the whole object from memory, because it's a constant. It's got the same position in memory. It's assigned what, Michael?
>> Michael: An object literal.
>> Will Sentance: Spot on, an empty object to which we're then gonna stick some properties. Talk me through the property assignment, Michael.
>> Michael: First one, we're gonna create a name property.
>> Will Sentance: With what value?
>> Michael: With a Julia.
>> Will Sentance: And?
>> Michael: And then score with a value of 5.
>> Will Sentance: Fantastic, and then we're gonna attach that pertinent functionality, that relevant functionality that we wanna have available on the object. Beautiful, there it is.
[00:01:40] It's the increment function. Can we now do our user2.increment? Don't panic! There's our increment function. We absolutely can.