1
00:00:02,029 --> 00:00:05,270
Let's continue with the destruction by this video.

2
00:00:05,270 --> 00:00:11,570
I'm going to show you how we can add different values when we are destruction and objects.

3
00:00:11,750 --> 00:00:19,100
So let's use the same object here as before and let me pass it here and let me uncomment it.

4
00:00:19,340 --> 00:00:19,870
Good.

5
00:00:19,880 --> 00:00:22,130
So now we have this particular object.

6
00:00:22,130 --> 00:00:24,980
So why do we need to add default values?

7
00:00:25,010 --> 00:00:26,540
Let me show you something here.

8
00:00:26,660 --> 00:00:29,360
Let's say that I want to structure.

9
00:00:29,360 --> 00:00:33,050
This particular object is equal to my object.

10
00:00:33,050 --> 00:00:36,020
I start and then I have first.

11
00:00:36,020 --> 00:00:36,430
Let me see.

12
00:00:36,440 --> 00:00:38,990
First name here is John as before.

13
00:00:39,260 --> 00:00:41,960
Now I want to get the values from this property.

14
00:00:41,960 --> 00:00:46,010
So I make use of first name and then let's say the edge.

15
00:00:46,610 --> 00:00:47,510
Perfect.

16
00:00:47,510 --> 00:00:52,700
So now if I check for these values, definitely I have the values in my console.

17
00:00:53,060 --> 00:01:01,790
But let's say that if I add, let's say three inside this destruction here, what will be the value

18
00:01:01,790 --> 00:01:06,950
if I make this or city inside my console or console.log the city property?

19
00:01:07,130 --> 00:01:12,290
So if I check for city here, you see I get undefined.

20
00:01:12,500 --> 00:01:16,760
Maybe the data that you want destroyed it can happen.

21
00:01:16,760 --> 00:01:22,280
That is coming from an external API and you know all the properties that is coming.

22
00:01:22,280 --> 00:01:28,340
But let's say that you want to take some values from the API, come in and add your own property to

23
00:01:28,340 --> 00:01:28,670
it.

24
00:01:28,970 --> 00:01:37,370
So let's say that we want to have city on the object, but after we saw that, well, there is no city,

25
00:01:37,710 --> 00:01:42,500
there's no city property inside the object, the value is going to be undefined.

26
00:01:42,530 --> 00:01:48,560
So in this case, you can provide a default value equal to, let's say, New York.

27
00:01:49,740 --> 00:01:50,550
As that.

28
00:01:50,670 --> 00:01:54,450
So now if I search for Siri, you see that?

29
00:01:54,450 --> 00:01:57,210
I'm going to have see I'm going to see what New York.

30
00:01:57,240 --> 00:02:00,210
That's how we can add default values.

31
00:02:00,390 --> 00:02:08,009
But one cool thing is that if there is property exists on the objects, the default value will never

32
00:02:08,009 --> 00:02:08,449
work.

33
00:02:08,460 --> 00:02:13,020
So let's say that for the first name, let's say the default value for this one has been.

34
00:02:14,890 --> 00:02:18,310
So there is first name on the object.

35
00:02:18,310 --> 00:02:24,400
So if I check for first name is John that it didn't take Ben as my default value.

36
00:02:24,760 --> 00:02:30,640
If I remove this one as an empty store, I'm going to see empty.

37
00:02:31,360 --> 00:02:32,410
Name, first name.

38
00:02:32,410 --> 00:02:34,240
But even though I have the family here.

39
00:02:34,360 --> 00:02:39,730
But if it doesn't exist at all, or let's say that's undefined, let's say undefined or so.

40
00:02:39,940 --> 00:02:44,470
And now let's search for the let's search for the first name.

41
00:02:45,160 --> 00:02:52,570
You see, now I have Ben, because it means that there is no value inside or for this particular property.

42
00:02:52,600 --> 00:02:54,200
That's why I have this.

43
00:02:54,220 --> 00:02:59,950
I mean, the default name being used as the value for this property.

44
00:03:00,190 --> 00:03:06,520
The next video I'm going to show you the most commonly used how we can do structure parameters.

45
00:03:06,640 --> 00:03:07,090
All right.

46
00:03:07,090 --> 00:03:08,710
So let's get started in the next video.

