🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## toLength + [link](./toLength "Link to this entry.") + [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L10542 "View in source.") + [npm](https://www.npmjs.com/package/lodash.tolength "See the npm package.") ``` _.toLength(value) ``` 转换 `value` 为用作类数组对象的长度整数。 **注意:** 这个方法基于 [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). ### 参数 1. value (\*) 要转换的值 ### 返回值 (number) 返回转换后的整数 ### 示例 ``` _.toLength(3); // => 3 _.toLength(Number.MIN_VALUE); // => 0 _.toLength(Infinity); // => 4294967295 _.toLength('3'); // => 3 ```