1
00:00:01,050 --> 00:00:05,340
Let's see how we can do structure parameters.

2
00:00:05,550 --> 00:00:08,760
So as before, we are going to use the same method.

3
00:00:09,060 --> 00:00:15,420
So let me comment this one from the previous and let me copy this one and paste down here.

4
00:00:15,630 --> 00:00:17,580
Let me comment this one out.

5
00:00:18,120 --> 00:00:23,820
And now down here, let's say this is called default or the structure parameters.

6
00:00:23,820 --> 00:00:24,390
So.

7
00:00:25,370 --> 00:00:26,600
Oh, sorry, guys.

8
00:00:27,680 --> 00:00:30,210
What's going to be the structure.

9
00:00:33,200 --> 00:00:34,160
Parameters.

10
00:00:35,520 --> 00:00:35,970
Good.

11
00:00:36,090 --> 00:00:45,630
So let's say that we have a function and that function display user to the page or to the console and

12
00:00:45,630 --> 00:00:47,070
this is our user object.

13
00:00:47,070 --> 00:00:50,370
So let me call this one as user object.

14
00:00:50,940 --> 00:00:54,690
So let's create a function to get the user.

15
00:00:54,690 --> 00:00:59,100
So a function and let's say get user.

16
00:00:59,640 --> 00:01:00,270
All right.

17
00:01:00,270 --> 00:01:03,090
And this function would take in the user.

18
00:01:03,090 --> 00:01:05,340
I want to what to display.

19
00:01:05,489 --> 00:01:10,260
So inside here, let's say that I want display the first in the last name of the user.

20
00:01:10,260 --> 00:01:19,140
Let's say console a log here is going to be console dot log, then I'll pass in the user.

21
00:01:19,140 --> 00:01:21,180
For the meantime, let's move step by step.

22
00:01:21,180 --> 00:01:26,550
So if I call this function now, pass in my user object as above here.

23
00:01:26,550 --> 00:01:32,850
So now you see that I have the values being displayed inside the console as that I have.

24
00:01:32,880 --> 00:01:33,500
Oh, let me see.

25
00:01:33,750 --> 00:01:34,290
As John.

26
00:01:34,290 --> 00:01:35,040
Sorry, guys.

27
00:01:35,040 --> 00:01:35,430
Not.

28
00:01:36,030 --> 00:01:37,470
Not only define.

29
00:01:39,250 --> 00:01:40,810
No, it's going to be fine.

30
00:01:42,000 --> 00:01:42,840
Ask John.

31
00:01:42,870 --> 00:01:43,290
Good.

32
00:01:43,290 --> 00:01:45,870
Now you have these values.

33
00:01:45,900 --> 00:01:48,450
Age 20 and first name John.

34
00:01:48,710 --> 00:01:49,110
Good.

35
00:01:49,110 --> 00:01:51,690
So I want display the first thing, the last name.

36
00:01:51,690 --> 00:01:55,770
So let's say I mean here as first.

37
00:01:57,010 --> 00:01:57,750
Name.

38
00:01:57,760 --> 00:02:03,020
So I'm going to be it's going to be user Dot's first name.

39
00:02:03,040 --> 00:02:03,760
Am I right?

40
00:02:03,760 --> 00:02:04,360
Yes.

41
00:02:04,360 --> 00:02:07,100
See that I have first name, which is.

42
00:02:07,120 --> 00:02:08,410
So let me ask this one.

43
00:02:08,979 --> 00:02:09,430
Yeah.

44
00:02:09,430 --> 00:02:11,650
First first name is John.

45
00:02:12,070 --> 00:02:15,790
If I want to display the last, this is the age.

46
00:02:15,910 --> 00:02:24,670
So let me say here the age are going to be user dot age is that I have them being displayed in the console.

47
00:02:25,060 --> 00:02:27,310
But this code is okay.

48
00:02:27,310 --> 00:02:28,060
But.

49
00:02:28,880 --> 00:02:30,380
We see we have some reputation.

50
00:02:30,380 --> 00:02:33,300
We have user, user and dot, dot.

51
00:02:33,320 --> 00:02:37,400
We see that in programming because something dri don't repeat yourself.

52
00:02:37,640 --> 00:02:42,890
So if you are coding and we see that you are repeating yourself many times with some variable, we need

53
00:02:42,890 --> 00:02:46,670
to think that, well, how can I avoid repetition?

54
00:02:46,760 --> 00:02:49,760
That is why destruction comes into play.

55
00:02:49,910 --> 00:02:51,860
So for this particular method.

56
00:02:51,860 --> 00:02:54,590
So let me comment this one maybe for future references.

57
00:02:55,070 --> 00:02:56,090
Copy and comment.

58
00:02:57,140 --> 00:02:58,330
Copy and comments.

59
00:02:58,340 --> 00:03:00,200
So let me paste them here as that.

60
00:03:00,350 --> 00:03:03,290
So let's see how we can make use of destruction.

61
00:03:03,290 --> 00:03:05,480
So we insert my parameters here.

62
00:03:05,480 --> 00:03:11,150
I'll bring in my carry basis and the property names, first name and then the H.

63
00:03:11,570 --> 00:03:15,500
So this property names must be on the object.

64
00:03:15,920 --> 00:03:17,840
Okay, so now we have that one.

65
00:03:17,840 --> 00:03:24,590
So now instead of using this dot dot, I remove all the dots here and just use the first name as my

66
00:03:24,590 --> 00:03:27,830
parameter here and then the h i is done.

67
00:03:27,830 --> 00:03:31,340
So if I save it, we have it as before.

68
00:03:31,340 --> 00:03:37,240
So this looks cleaner than this dot, dot or the square bracket.

69
00:03:37,250 --> 00:03:39,860
If you go back that way, that is not sure.

70
00:03:39,890 --> 00:03:43,940
Destruction is all about the next video.

71
00:03:43,970 --> 00:03:50,330
We will talk about another main features which is called rest parameters.

