> 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/lang/tolength.md).

# \_.toLength（强转为整数）

**语法：**

```javascript
_.toLength(value)
```

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

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

**描述：**

转换`value`为用作类数组对象的长度整数。

> **注意:**&#x8FD9;个方法基于[`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).

**开始版本：**&#x34;.0.0

**参数：**

* `value (*)`: 要转换的值。

**返回值：**

* `(number)`: 返回转换后的整数。

**例子：**

```javascript
_.toLength(3.2);
// => 3

_.toLength(Number.MIN_VALUE);
// => 0

_.toLength(Infinity);
// => 4294967295

_.toLength('3.2');
// => 3
```
