1
00:00:00,640 --> 00:00:01,480
This video.

2
00:00:01,480 --> 00:00:07,360
Let's talk about the last method and that is the object dot entries.

3
00:00:08,080 --> 00:00:10,480
Let's have some enough room to code.

4
00:00:10,810 --> 00:00:13,060
So let me copy this one.

5
00:00:13,840 --> 00:00:16,180
And then let me comment this one out.

6
00:00:16,300 --> 00:00:17,290
Now come down.

7
00:00:17,290 --> 00:00:23,350
Here it and here is going to be my objects.

8
00:00:23,350 --> 00:00:25,570
Dot entries.

9
00:00:26,920 --> 00:00:28,340
So what is it?

10
00:00:28,360 --> 00:00:39,970
Well, the object dot entries method, it retains an array where each array contains a key and the value.

11
00:00:40,450 --> 00:00:45,100
Well, this is really useful when you want to treat over the properties of an object.

12
00:00:45,190 --> 00:00:46,420
Well, so let's see.

13
00:00:46,720 --> 00:00:50,620
Let's in action to better understand this definition I gave you.

14
00:00:50,680 --> 00:00:51,740
So const.

15
00:00:51,940 --> 00:01:04,780
Let's say my object entries now is is entries is equal to object uppercase dot entries.

16
00:01:04,810 --> 00:01:09,160
Then I'll pass in my person object.

17
00:01:10,100 --> 00:01:10,880
How is that?

18
00:01:11,180 --> 00:01:18,020
So if I console that look, my object entries have a look.

19
00:01:20,150 --> 00:01:20,540
Okay.

20
00:01:20,570 --> 00:01:21,120
Open it.

21
00:01:21,140 --> 00:01:21,910
We see that.

22
00:01:22,690 --> 00:01:28,030
It has put in the individual properties in a separate array.

23
00:01:28,420 --> 00:01:31,350
So let me show you that the first one is first name.

24
00:01:31,360 --> 00:01:33,330
So that the first one give me array.

25
00:01:33,340 --> 00:01:37,450
We have the first name, the key and the value is John.

26
00:01:37,570 --> 00:01:40,620
The next property was last name and then my value.

27
00:01:41,020 --> 00:01:44,530
They have put everything in a separate word array.

28
00:01:44,890 --> 00:01:50,350
So there are some useful there are some use cases where you may need this concept.

29
00:01:50,680 --> 00:01:58,300
Well, so for this one, we can go ahead and also maybe we can use for loop to loop through this element

30
00:01:58,300 --> 00:02:00,130
and get the individual entries.

31
00:02:00,730 --> 00:02:07,930
Or let's use for loop, let's use for a loop to see how we can loop through this one and you see how

32
00:02:07,930 --> 00:02:09,520
you're going to get the result.

33
00:02:09,789 --> 00:02:16,030
So here I'm going to have the object entries dot for each loop.

34
00:02:16,940 --> 00:02:21,230
For each loop pass in my callback function.

35
00:02:21,500 --> 00:02:27,770
And now here I get access to the individual entry and then my carry basis.

36
00:02:28,100 --> 00:02:31,490
So here, our console log the entry.

37
00:02:33,800 --> 00:02:37,400
Let's see now and see that I get it as before.

38
00:02:37,400 --> 00:02:45,520
But now I have them separately inside my for each loop and you cause something destruction assignment

39
00:02:45,530 --> 00:02:47,060
so the same way.

40
00:02:47,420 --> 00:02:48,830
So here it is advanced.

41
00:02:48,860 --> 00:02:49,630
Don't worry.

42
00:02:49,640 --> 00:02:54,380
The whole idea is get know how to use these entries and how.

43
00:02:54,380 --> 00:02:58,670
And I mean the meaning of these entry method and how they are used.

44
00:02:58,700 --> 00:03:03,890
As we move on and by solving some coding challenges, you better understand them in some way.

45
00:03:03,890 --> 00:03:04,760
Use cases.

46
00:03:05,060 --> 00:03:10,250
So here, what I'm going to do is I'm going to use a method called distraction assignment.

47
00:03:10,700 --> 00:03:11,450
Let me show you.

48
00:03:13,430 --> 00:03:15,080
Destruction assignment.

49
00:03:18,440 --> 00:03:19,160
So let's see.

50
00:03:19,160 --> 00:03:25,610
I would take my entries, my assets, my object, and let me comment this one out.

51
00:03:25,610 --> 00:03:26,950
So this one is reason for loop.

52
00:03:26,970 --> 00:03:35,030
Okay, so I would take my object entries, object entries and then dot for each the same way.

53
00:03:35,780 --> 00:03:39,680
Dot for each, for each.

54
00:03:39,680 --> 00:03:45,170
Then my callback function I'll start and then I'll start.

55
00:03:45,410 --> 00:03:49,880
But inside my callback function I'm going to structure this.

56
00:03:49,880 --> 00:03:52,520
Also a new feature in Java code instruction.

57
00:03:52,670 --> 00:03:54,650
For the meantime, just bear with me.

58
00:03:54,860 --> 00:04:00,860
Remember that this entries retains array of key value pairs.

59
00:04:00,890 --> 00:04:01,790
Let me show you here.

60
00:04:01,910 --> 00:04:08,930
So if our comment this one out, let's see we see that we have the key and a value.

61
00:04:08,930 --> 00:04:16,490
So this once represent the individual entry inside this function I'm going to have so I can structure

62
00:04:16,490 --> 00:04:20,180
that using a mean square bracket.

63
00:04:20,180 --> 00:04:22,790
So inside my callback function.

64
00:04:24,450 --> 00:04:25,050
Here.

65
00:04:25,320 --> 00:04:27,180
Now I can do structure.

66
00:04:27,780 --> 00:04:29,370
And then the first key.

67
00:04:29,370 --> 00:04:32,910
The first one is my key and comma, my value.

68
00:04:33,330 --> 00:04:40,200
So in here I can console.log it and give it some nice details and say that, well, I'm going to have

69
00:04:40,200 --> 00:04:48,420
my my temporarily try here dollar sign carry basis and then I have my key, my key here inside that

70
00:04:48,420 --> 00:04:54,270
and then I'm going to have semicolon and then I'll have my dollar sign, curly braces and my value.

71
00:04:55,620 --> 00:04:57,510
So let me comment this one.

72
00:04:57,600 --> 00:05:00,900
I want to see the results of this one and now have a look.

73
00:05:01,410 --> 00:05:09,510
We see I get first name John, last name double H like that and like that.

74
00:05:09,510 --> 00:05:13,650
Like I said, there are some use cases where you may need this concept.

75
00:05:13,680 --> 00:05:17,070
Not always you may need, but in some use cases.

76
00:05:17,070 --> 00:05:24,570
Well, guys, so here ends the object basics even though it is not business but high C is a basic right

77
00:05:24,870 --> 00:05:28,260
because advance I'm going to make things more complicated.

78
00:05:28,260 --> 00:05:33,210
I mean by I then I mean advanced object to a method, right?

79
00:05:33,210 --> 00:05:37,260
So the next video, let's start with our first coding challenge.

