Array
Collection
Date
Function
Lang
Math
Object
Seq
String
Util
Properties
Methods
“Lang” Methods
_.toLength(value)
Converts value
to an integer suitable for use as the length of an array-like object.
Note: This method is based on ToLength
.
引入版本
4.0.0
参数
value
(*)
: The value to convert.
返回值
(number)
: Returns the converted integer.
示例
_.toLength(3.2);// => 3 _.toLength(Number.MIN_VALUE);// => 0 _.toLength(Infinity);// => 4294967295 _.toLength('3.2');// => 3