# Binding Calls to Apply

You know that you can use the `apply`

method when you want to use an array as a list of parameters:

```
let nums = [3, 1, 4, 1, 5, 9];
let highest = Math.max.apply(Math, nums);
```

If you need to do this a lot, maybe you want to create a new function that expects an array as its parameter:

```
function max(arr) {
return Math.max.apply(Math, arr);
}
var highest = max(nums);
```

An alternative way to do this is to `bind`

that call to `apply`

.

```
const max = Math.max.apply.bind(Math.max, Math);
```

Confused? Here's how it works:

- Remember that every function has a
`bind`

method, so we can call`bind`

on`apply`

. - The first parameter to
`bind`

should be the context (the`this`

value), of the function being bound. In our case, the function we're binding is`Math.max.apply`

, and when we call that function, we want`this`

to be`Math.max`

. So that's the first parameter to`bind`

. - Any subsequent arguments to
`bind`

will be "prepended to the arguments provided to the bound function" (MDN). Since we're passing`Math`

, that will be the first parameter to`Math.max.apply`

, which is what we want. - The result of all this is a function whose first expected parameter is the second parameter you would pass to
`apply`

, that is, the array of parameters.