Let's see how we can update.
Object properties so we can do the same thing using two ways or in two ways.
So let me comment this once that is under the ACT Section Properties and object.
That is accessing properties of an object.
So let me copy this one first and then let me comment out.
Now everything is gone.
So calm down here and let's say I think the current is best month, okay?
Let's say here is here is going to be as updating object properties.
Updating Objet properties.
Yes.
Yeah.
So let me paste my object here.
Good.
We can achieve this logic in two ways.
One is using the dot notation.
So here I will say update.
Update.
The person.
Name.
Okay.
So using the dot notation, let me say here, using the.
The dot notation.
Good.
So here we go.
You take the person and then Dot's name, and then E go to the name.
You want to change?
Let's say change this one to Billy.
That is it.
I've changed.
I'm done.
So if I check for my objects.
My person object inside my console here.
Now let's see that the name is no more John, but instead is Billy because originally it is joined here.
But after updating, I'll change this one to Billy.
I can also change the present age.
So person don't age.
At this point you are 100 years.
So if I check for person, you see that I have what, 100 years instead of 30 years?
So I can also change the person dot hobbies.
Now instead of cooking, I would say you like hiking.
Let's say you like also ski.
Let's see.
Also, like dancing.
Yes.
Now let's see.
Let me check for person.
Now, look at the array we have.
What?
RB or hobbies.
We have hiking and dancing.
Not dancing, but dancing.
Changes one to.
Dancing.
Yes.
Check it out again.
Now I have what I have dancing inside my RV.
How we start.
We have the index zero.
Represent the hiking and add index one is dancing remember.
And the array section of this course.
Perfect.
So now that is it about the updating using the.
Dot notation.
So why is this possible?
Well, it's because the way object is objects are always passed by reference, meaning that whatever
you make changes to the object, it affects the original one because you are referencing to that.
Right.
So behind the scene, we've made a copy of this original array.
And then let me show you something here.
We made a copy of this original array.
Let's see, this is my copy here.
Now, this is my copy here.
And now I want to override the name to, let's say, Billy.
Because I referenced I was going to update the original data that is advance topic about how object
behaved object are passed by reference.
So I'll explain to you some function very soon, but not very soon, let's say in the upcoming section
of this course.
Okay, that is the using the dot notation for you.
What about using the bracket notation.
So here also using the bracket bracket notation.
So let me comment this one out or so the same way you make use of person and then square brackets,
single or double codes each.
Now this one, you are 90 years.
Save it.
Let's check the person.
No.
I have the 90 years also.
So let's say that I did the person hobby square bracket code and let's see hobbies let's say this time
around you don't like cooking, neither dancing.
Let's say this time around.
Let's say you would like coding this by a hobby.
Let's say the person also like outing.
Like going out.
Right.
So if I check the console for that, see that now the.
Oh.
Where I still have.
Oh yeah.
You see I taught is cooking coding out in and then age is 90 years and then they see that the properties
are updated are the one that has been changed because here we are updating what the age and then the
hobbies.
So the name and this merit would be the same we know would not be changed.
That's why we have it as that.
Okay, guys, so that is it about that.
What about let's say that.
Well.
After some time, a user comes into the place.
I don't need my name anymore.
Or based on the based on the business logic of your application can see that well after we decided to
keep track of person's age.
I think age is too personal.
Right?
So let me delete the age after I finish creating my object.
How is it possible?
How is it?
Pass me thinking.
Well, I can come in and remove it from here, but do it programmatically.
So let's see how we can delete properties of an object.
The next video.