> For the complete documentation index, see [llms.txt](https://lodash.shujuwajue.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lodash.shujuwajue.com/function/bind.md).

# \_.bind

**语法：**

```javascript
_.bind(func, thisArg, [partials])
```

**源代码链接：**[source](https://github.com/lodash/lodash/blob/4.17.10/lodash.js#L10094)

**npm包链接：**[npm package](https://www.npmjs.com/package/lodash.bind)

**描述：**

创建一个调用`func`的函数，`thisArg`绑定`func`函数中的`this` ，并且`func`函数会接收`partials`附加参数。

`_.bind.placeholder`值，默认是以`_`作为附加部分参数的占位符。

**注意:**&#x4E0D;同于原生的`Function#bind`，这个方法不会设置绑定函数的 "length" 属性。

**开始版本：**&#x30;.1.0

**参数：**

* `func (Function)`: 绑定的函数。
* `thisArg (*)`: func 绑定的this对象。
* `[partials] (...*)`: 附加的部分参数。

**返回值：**

* `(Function)`: 返回新的绑定函数。

**例子：**

```javascript
var greet = function(greeting, punctuation) {
  return greeting + ' ' + this.user + punctuation;
};

var object = { 'user': 'fred' };

var bound = _.bind(greet, object, 'hi');
bound('!');
// => 'hi fred!'

// Bound with placeholders.
var bound = _.bind(greet, object, _, '!');
bound('hi');
// => 'hi fred!'
```
