WEBVTT 00:06.440 --> 00:10.790 In this video you're going to learn restructuring with functions in E6. 00:10.790 --> 00:18.950 So just like we did with objects on the array you can do parameter matching in function declarations. 00:18.950 --> 00:29.660 So first let's go back to iOS 5 and create a function f which takes the REI and logs 00:32.350 --> 00:38.000 something like Hello plus the first elements of the array. 00:40.150 --> 00:48.670 Plus a space that's the second element of the array so supposing here we were assuming this the array 00:48.970 --> 00:53.180 is made of two elements or at least two elements. 00:53.330 --> 00:53.910 Right. 00:53.980 --> 00:56.320 So now if you try f of 01:05.020 --> 01:06.040 Bill Gates 01:10.160 --> 01:12.380 this is what you get. 01:12.380 --> 01:13.000 All right. 01:13.070 --> 01:19.370 So now let's move to E6 and use the structuring or parameter matching 01:25.680 --> 01:30.030 so we're gonna declare we define a new function. 01:30.030 --> 01:33.070 So let's call it s g this time. 01:33.420 --> 01:40.170 So if you know that you're expecting an array of two elements then you can do probably something like 01:40.170 --> 01:47.230 this and have your first element and a second element inside the array. 01:47.270 --> 02:00.850 Now when logging this you can simply use the promises that you see the without having to go to the array 02:01.450 --> 02:08.320 elements and then selecting the or accessing the elements using their indexes. 02:08.320 --> 02:09.930 All right. 02:10.080 --> 02:20.340 So now let's use template liberals and write Hello First Name Last Name 02:32.690 --> 02:42.540 is destroy again g of Bill Gates and see where you get. 02:42.570 --> 02:45.670 Here we go prefix. 02:45.960 --> 02:50.260 Now you can do the same thing with objects. 02:50.760 --> 02:52.130 So let's say that's your goals. 02:52.140 --> 03:04.500 A function call it s h which takes an object and this time let's go straight away to parameter matching. 03:04.640 --> 03:06.260 So we're gonna have first name 03:10.970 --> 03:16.990 and last name as the properties. 03:17.510 --> 03:23.600 So basically here you are interested in using the values or the variables first name and last name which 03:23.600 --> 03:26.210 you will find in the primary so much. 03:26.560 --> 03:27.100 Okay. 03:27.320 --> 03:33.330 So now we just want to log hello first name and last name. 03:33.470 --> 03:38.400 So again we're gonna use this structuring and we can just copy paste the same thing we have a 03:44.280 --> 03:47.970 SO IF YOU TRY h of 04:00.890 --> 04:08.270 first name Mark and last name look at big 04:11.150 --> 04:13.130 you will get the correct results. 04:13.290 --> 04:16.220 Right now you can also reduce these. 04:16.250 --> 04:21.770 So instead of first name first name last name last name you could destroy its first name and last name. 04:21.860 --> 04:24.500 So it's way using objects restructuring.