1
00:00:00,270 --> 00:00:03,140
Now that we've seen call let's take a look at apply.

2
00:00:03,330 --> 00:00:08,850
Remember that the only difference between these two is when we have arguments to the function that we're

3
00:00:08,850 --> 00:00:14,060
using call or apply on in the previous example with the same high method.

4
00:00:14,070 --> 00:00:19,980
It didn't matter if we use call or apply We only start to see a difference when we start adding arguments

5
00:00:19,980 --> 00:00:20,770
.

6
00:00:20,790 --> 00:00:24,280
Let's take a look at the add numbers function to illustrate this point.

7
00:00:24,570 --> 00:00:30,300
Here we are concatenating the value of the first name property with the string just calculated and the

8
00:00:30,300 --> 00:00:36,840
sum of four numbers which are parameters to the Add numbers function when we call Coltart add numbers

9
00:00:36,840 --> 00:00:37,020
.

10
00:00:37,020 --> 00:00:38,830
This function behaves like we want it to.

11
00:00:38,970 --> 00:00:44,940
Since the keyword this refers to the cold object if we want to borrow the add numbers function from

12
00:00:44,940 --> 00:00:52,650
Colt and set the keyword this to refer to the elhi object we can use call or apply in order to pass

13
00:00:52,680 --> 00:00:54,870
arguments to the function using call.

14
00:00:54,930 --> 00:00:56,750
We separate them with a comma.

15
00:00:56,940 --> 00:01:03,750
So you can see here that when we use call the arguments we pass one to three and four are separated

16
00:01:03,750 --> 00:01:05,040
by a comma.

17
00:01:05,370 --> 00:01:09,800
In the case of apply we pass all of the arguments as values in an array.

18
00:01:09,870 --> 00:01:15,660
So it looks very similar to call but instead of comma separated values as arguments we put them all

19
00:01:15,660 --> 00:01:17,540
inside of one array.

20
00:01:17,580 --> 00:01:21,590
We'll see in a later video why this might be valuable in the next video.

21
00:01:21,660 --> 00:01:27,000
We're going to talk a bit more about bind and see just how helpful it can be when working with asynchronous

22
00:01:27,000 --> 00:01:27,750
code.

23
00:01:27,810 --> 00:01:28,430
See you then.
