用AI赚第一桶💰低成本搭建一套AI赚钱工具,源码可二开。 广告
## toSafeInteger + [link](./toSafeInteger "Link to this entry.") + [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L10633 "View in source.") + [npm](https://www.npmjs.com/package/lodash.tosafeinteger "See the npm package.") ``` _.toSafeInteger(value) ``` 转换 `value` 为安全整数。 安全整数可以用于比较和准确的表示。 ### 参数 1. value (\*) 要转换的值 ### 返回值 (number) 返回转换后的整数 ### 示例 ``` _.toSafeInteger(3); // => 3 _.toSafeInteger(Number.MIN_VALUE); // => 0 _.toSafeInteger(Infinity); // => 9007199254740991 _.toSafeInteger('3'); // => 3 ```