Now that we've seen call let's take a look at apply.
Remember that the only difference between these two is when we have arguments to the function that we're
using call or apply on in the previous example with the same high method.
It didn't matter if we use call or apply We only start to see a difference when we start adding arguments
.
Let's take a look at the add numbers function to illustrate this point.
Here we are concatenating the value of the first name property with the string just calculated and the
sum of four numbers which are parameters to the Add numbers function when we call Coltart add numbers
.
This function behaves like we want it to.
Since the keyword this refers to the cold object if we want to borrow the add numbers function from
Colt and set the keyword this to refer to the elhi object we can use call or apply in order to pass
arguments to the function using call.
We separate them with a comma.
So you can see here that when we use call the arguments we pass one to three and four are separated
by a comma.
In the case of apply we pass all of the arguments as values in an array.
So it looks very similar to call but instead of comma separated values as arguments we put them all
inside of one array.
We'll see in a later video why this might be valuable in the next video.
We're going to talk a bit more about bind and see just how helpful it can be when working with asynchronous
code.
See you then.