1 00:00:01,480 --> 00:00:08,560 OK, let's look next at object restructuring, so the structuring is pulling something apart, taking 2 00:00:08,560 --> 00:00:14,790 a structure away, so a basic destruction looks like this will define as a constant. 3 00:00:15,460 --> 00:00:22,750 And what we do is we define some variables inside curly braces, ID name age that match up to the object 4 00:00:22,750 --> 00:00:23,440 properties. 5 00:00:24,100 --> 00:00:30,010 And so we can do is pull the idea, the name and the age out of this object and store them in variables 6 00:00:30,910 --> 00:00:32,350 so it pulls the object apart. 7 00:00:33,760 --> 00:00:39,610 You can rename the the properties so I can say ID, we're going to call my ID and name, we're going 8 00:00:39,610 --> 00:00:47,160 to call my name inside this OBJ and then you can also define some default values. 9 00:00:47,560 --> 00:00:51,790 So if Object doesn't have the name, its name will be Sue. 10 00:00:54,210 --> 00:01:01,380 And then you combine those and say, idee my equals one, two, three, that's the default name, my 11 00:01:01,380 --> 00:01:04,050 name equals Mary and that's the default. 12 00:01:05,540 --> 00:01:08,540 So let's look at some of the examples of these and these code. 13 00:01:11,970 --> 00:01:17,910 All right, I'm going to start with this object definition that we had before, more or less of an employee. 14 00:01:18,720 --> 00:01:30,360 So let's break this down into separate variables so I can say what name, age, job, salary 15 00:01:33,000 --> 00:01:34,680 equals out. 16 00:01:36,720 --> 00:01:45,630 And then we will those out console that log name, age, job, salary. 17 00:01:49,510 --> 00:01:58,300 So so name is Bill, age of 33, Jarvis Carpenter salaries ten point five. 18 00:01:58,750 --> 00:02:01,810 Now, there's no need to put them in the same order. 19 00:02:02,080 --> 00:02:03,970 There's no need to get them all. 20 00:02:04,660 --> 00:02:10,140 So I could just say job equals and so it just matches up the name. 21 00:02:10,960 --> 00:02:13,300 So we'll just output only job. 22 00:02:21,310 --> 00:02:27,160 And Carpenter, so it only matched what you needed to match in here so I could call this 23 00:02:30,760 --> 00:02:31,510 profession. 24 00:02:34,970 --> 00:02:37,520 And then I guess the name profession instead of job. 25 00:02:40,600 --> 00:02:45,530 So the professionals carpenter and I could say, what say that there's another. 26 00:02:47,740 --> 00:02:57,610 We think there might be another variable in here called experience, but I don't know if a employee 27 00:02:57,610 --> 00:03:01,000 has experienced I'm going to say equals zero. 28 00:03:03,660 --> 00:03:04,590 So profession 29 00:03:07,590 --> 00:03:08,430 experience. 30 00:03:14,920 --> 00:03:18,250 So Carpenters' zero now if this object didn't have experience 31 00:03:26,610 --> 00:03:27,790 in 12, just 12. 32 00:03:31,950 --> 00:03:39,090 And so that gets matched in, by the way, with objects you don't necessarily have to to put that into 33 00:03:39,090 --> 00:03:40,080 the definition. 34 00:03:40,550 --> 00:03:49,730 The original definition could be this, and you're perfectly free to say that experience equals 12 and 35 00:03:49,790 --> 00:03:51,390 it's going to add it into the object. 36 00:03:57,840 --> 00:04:11,610 So I could rename experience and say time on the job explaining to put that over here time my job equals 37 00:04:11,610 --> 00:04:12,040 zero. 38 00:04:12,420 --> 00:04:13,250 Same thing. 39 00:04:14,010 --> 00:04:16,290 I am offering time on job down here now. 40 00:04:21,650 --> 00:04:22,290 And there we go. 41 00:04:24,140 --> 00:04:30,080 So that is an introduction to object restructuring, which breaks objects down into their individual 42 00:04:30,080 --> 00:04:30,590 values.