So let's see how we can delete properties of an object and we can do it in two ways using the dot notation
and using the bracket notation.
So let me comment this one and my object.
Copy it and let me comment that one.
Then come down here, let's say deleting object property.
Deleting objects.
Properties.
Yes.
So here we go.
Let me paste my object here.
So how can we do it?
So let's use the.
Using the dot.
In rotation.
Let's see.
So let's say delete the person.
Okay, let me say let me add some more confidential property, for example, is what?
Let's see.
Okay.
It's okay.
I don't want to be more personal here.
So delete the.
Delete the H, the H property.
The H property.
Yes.
Good.
So all what we need is you bring in delete.
This is a special keyword in JavaScript.
Delete as that.
This variable is known as who made it.
So name it as delete.
And then what do you want?
Delete.
So I will take the person dart edge.
That is it.
So I have deleted it.
So if I check my console here, then if I search for person record, do I have h init h is gone.
It's nowhere to be found, but h is here in the original array, in the original object.
You see that?
So even after this one, one good thing you need to bear in mind understand why objects are parsed by
reference is that if we see that we have deleted this h.
Okay.
So if I console.log again, this person are not able to see the H because behind the scene it has remove
it from here.
That is one method.
What about using the bracket notation?
So using the bracket.
Notation also asks you bring delete and then person square bracket single or double code and let's say
hobbies remove that.
So let me comment this one out here and now let's see, check the person.
Do we have hobbies in it?
No.
Everything is gone forever.
So you may be asking, what are some of the use cases?
Okay.
Let me show you one thing here we can say is admit to true.
And then let's say that the person let me say starters, for example, let's say A is not verify.
Okay, let's say not.
Verify.
So we can make a logic that where you want to check inside this object, a person object, if the person
status is not verified, then we are going to remove this property called is admin.
It's admin.
So that is why we need method to make something like this happen.
So in this video, I'm going to show you how we can add our custom methods to object so that we can
do more logic in any way that we want.