Welcome back.
In this video, let's see how we can upgrade or loop through an object.
Remember, objects are not arrays where we can use for in loop and other ones or other methods to do
it.
But how can we get or how can we loop through in a trade over, I mean, properties of an object.
So let me show you.
So let me comment this one out.
Let me copy this one.
The entire object here and now.
Come down here and let's say that.
I iterating over objects.
Properties.
Let me paste my object here.
So let me remove I think I have the objects here also.
Let me comment this one here.
Great.
So now how can we let me remove the functions inside this?
Great.
So how can we trade over these properties?
We have four ways of iterating over properties of an object, and the first one is using the four in
loop.
So one is using four.
The loop.
Well, these are some of the advanced topics.
Right, but are making us a beginner topic.
Right.
So let's go.
The next method is what you call objects dot keys, objects, dot keys method.
And this one is using the object.
A point number three is objects.
Dot values.
Lastly is going to be object dots.
Entries.
Hmm.
One more time, you will try to revisit this because you may need this logic to be able to solve our
coding challenge.
That's why we are doing us on the basis of JavaScript.
But is advanced topic good?
So what does the let's start with the four in loop for in loop.
So this is the syntax.
So come down here and let's write a syntax.
So a syntax.
Goes like this, we bring in four and then mine in parentheses and then let key in.
E object and as that.
So let's go over again what this property means.
This lad is a must.
But this late is a special keyword to bring us light.
But this key might be anything but normally we use key.
And then in is is a must read is addressed.
And this object can be any object.
So let's see.
The key is a name of the properties of the object.
So here, these are my key.
And these are my values.
So inside this these key represents these keys.
Here you get it.
And then this object represents the object that we are trying to find, which is the person.
So here is going to be what?
Person.
Let's make it as personal objects here.
So let's see.
There is a person up to here going to be as what person object.
So now if I console.log the key.
The key insight.
Now let's see.
So that we have the keys as.
Where is my.
Yeah.
Here we go.
We have the first name.
My key here.
Last name?
H.
View count is married.
Hobbies is admin and started off able to get all my keys.
So what are the use cases here?
Maybe.
Well, it depends.
Sometimes you want to check if there are some URLs, a key or on a certain object.
Otherwise we can add additional key to the object where we can go by using this for a loop to get the
properties of an object that is therefore in loop for you.