1
00:00:00,650 --> 00:00:01,700
Welcome back.

2
00:00:01,730 --> 00:00:06,920
In this video, let's see how we can upgrade or loop through an object.

3
00:00:07,290 --> 00:00:13,160
Remember, objects are not arrays where we can use for in loop and other ones or other methods to do

4
00:00:13,160 --> 00:00:13,490
it.

5
00:00:13,670 --> 00:00:20,450
But how can we get or how can we loop through in a trade over, I mean, properties of an object.

6
00:00:20,450 --> 00:00:22,100
So let me show you.

7
00:00:22,490 --> 00:00:25,970
So let me comment this one out.

8
00:00:26,000 --> 00:00:27,320
Let me copy this one.

9
00:00:27,320 --> 00:00:30,140
The entire object here and now.

10
00:00:30,140 --> 00:00:32,509
Come down here and let's say that.

11
00:00:34,390 --> 00:00:38,620
I iterating over objects.

12
00:00:40,300 --> 00:00:41,170
Properties.

13
00:00:43,010 --> 00:00:44,330
Let me paste my object here.

14
00:00:44,330 --> 00:00:46,880
So let me remove I think I have the objects here also.

15
00:00:46,880 --> 00:00:48,880
Let me comment this one here.

16
00:00:50,610 --> 00:00:51,670
Great.

17
00:00:51,690 --> 00:00:55,800
So now how can we let me remove the functions inside this?

18
00:00:57,030 --> 00:00:57,750
Great.

19
00:00:57,750 --> 00:01:02,310
So how can we trade over these properties?

20
00:01:02,700 --> 00:01:13,620
We have four ways of iterating over properties of an object, and the first one is using the four in

21
00:01:13,620 --> 00:01:14,130
loop.

22
00:01:15,000 --> 00:01:18,450
So one is using four.

23
00:01:20,130 --> 00:01:22,200
The loop.

24
00:01:22,780 --> 00:01:25,350
Well, these are some of the advanced topics.

25
00:01:25,350 --> 00:01:28,980
Right, but are making us a beginner topic.

26
00:01:28,980 --> 00:01:29,550
Right.

27
00:01:29,670 --> 00:01:30,660
So let's go.

28
00:01:30,960 --> 00:01:38,450
The next method is what you call objects dot keys, objects, dot keys method.

29
00:01:38,460 --> 00:01:41,310
And this one is using the object.

30
00:01:42,790 --> 00:01:45,600
A point number three is objects.

31
00:01:45,640 --> 00:01:47,830
Dot values.

32
00:01:48,820 --> 00:01:53,330
Lastly is going to be object dots.

33
00:01:53,350 --> 00:01:54,400
Entries.

34
00:01:56,280 --> 00:01:56,550
Hmm.

35
00:01:57,090 --> 00:02:02,880
One more time, you will try to revisit this because you may need this logic to be able to solve our

36
00:02:02,880 --> 00:02:03,950
coding challenge.

37
00:02:03,960 --> 00:02:07,650
That's why we are doing us on the basis of JavaScript.

38
00:02:07,650 --> 00:02:10,430
But is advanced topic good?

39
00:02:10,440 --> 00:02:16,110
So what does the let's start with the four in loop for in loop.

40
00:02:17,310 --> 00:02:20,090
So this is the syntax.

41
00:02:20,100 --> 00:02:22,920
So come down here and let's write a syntax.

42
00:02:22,920 --> 00:02:24,210
So a syntax.

43
00:02:26,090 --> 00:02:36,260
Goes like this, we bring in four and then mine in parentheses and then let key in.

44
00:02:37,120 --> 00:02:40,660
E object and as that.

45
00:02:40,870 --> 00:02:43,420
So let's go over again what this property means.

46
00:02:43,720 --> 00:02:46,930
This lad is a must.

47
00:02:47,700 --> 00:02:51,540
But this late is a special keyword to bring us light.

48
00:02:51,780 --> 00:02:56,910
But this key might be anything but normally we use key.

49
00:02:57,150 --> 00:03:01,820
And then in is is a must read is addressed.

50
00:03:01,860 --> 00:03:04,280
And this object can be any object.

51
00:03:04,290 --> 00:03:05,040
So let's see.

52
00:03:05,370 --> 00:03:09,540
The key is a name of the properties of the object.

53
00:03:09,990 --> 00:03:12,210
So here, these are my key.

54
00:03:13,560 --> 00:03:15,080
And these are my values.

55
00:03:15,090 --> 00:03:19,470
So inside this these key represents these keys.

56
00:03:19,470 --> 00:03:21,030
Here you get it.

57
00:03:21,030 --> 00:03:26,370
And then this object represents the object that we are trying to find, which is the person.

58
00:03:26,670 --> 00:03:28,770
So here is going to be what?

59
00:03:29,750 --> 00:03:30,500
Person.

60
00:03:31,170 --> 00:03:33,840
Let's make it as personal objects here.

61
00:03:33,870 --> 00:03:34,380
So let's see.

62
00:03:34,380 --> 00:03:38,040
There is a person up to here going to be as what person object.

63
00:03:38,250 --> 00:03:42,180
So now if I console.log the key.

64
00:03:43,130 --> 00:03:44,360
The key insight.

65
00:03:44,780 --> 00:03:46,070
Now let's see.

66
00:03:46,970 --> 00:03:48,980
So that we have the keys as.

67
00:03:49,430 --> 00:03:50,300
Where is my.

68
00:03:50,340 --> 00:03:50,720
Yeah.

69
00:03:51,200 --> 00:03:51,890
Here we go.

70
00:03:52,190 --> 00:03:56,040
We have the first name.

71
00:03:56,060 --> 00:03:57,200
My key here.

72
00:03:57,230 --> 00:03:58,280
Last name?

73
00:03:58,370 --> 00:03:59,180
H.

74
00:04:00,030 --> 00:04:02,400
View count is married.

75
00:04:02,910 --> 00:04:08,880
Hobbies is admin and started off able to get all my keys.

76
00:04:09,180 --> 00:04:12,450
So what are the use cases here?

77
00:04:13,050 --> 00:04:13,830
Maybe.

78
00:04:13,860 --> 00:04:15,500
Well, it depends.

79
00:04:15,510 --> 00:04:22,760
Sometimes you want to check if there are some URLs, a key or on a certain object.

80
00:04:22,770 --> 00:04:31,800
Otherwise we can add additional key to the object where we can go by using this for a loop to get the

81
00:04:31,800 --> 00:04:39,150
properties of an object that is therefore in loop for you.

